Scopes and claims

Every scope a onefold application can request, the claims each one returns in the ID token and from userinfo, and how scopes relate to consent.

A scope is a permission your application asks a user for. A claim is one piece of information onefold returns about that user. The scopes a user grants decide which claims you can read. This page is the reference for both.

Scopes

ScopeWhat it grantsHow you enable it
openidAn ID token, and the OpenID Connect userinfo endpointAlways available. Request it; there is nothing to switch on.
identityUsername, email address, verification status, display name and date of birthThe Identity switch on the application's OAuth2 tab. On by default.
profileUsername, display name, avatar and other profile detailsThe Profile switch on the OAuth2 tab
socials:<provider>Data from the user's account at a social provider, for example socials:githubConfigure the provider first. See Social login.

Rules:

  • Send scopes space-separated in the scope parameter of the authorization request.
  • A request for a scope that is not enabled for the application fails with invalid_scope.
  • Every scope is read-only. No scope lets your application change an account.
  • Without openid, the flow is plain OAuth 2.0: you receive an access token and a refresh token, no ID token, and /o/userinfo/ refuses the access token. Use /api/v1/userinfo/ instead.

Claims from userinfo

Call GET /o/userinfo/ or GET /api/v1/userinfo/ with the access token. Both return the same claims.

ClaimTypeReturned withMeaning
substringAlwaysThe user's ID. Stable for the life of the account.
idstringAlwaysThe same value as sub
usernamestringidentity or profileThe user's username. It can change.
preferred_usernamestringidentity or profileThe same value as username, under its OpenID Connect name
is_verifiedbooleanidentity or profileWhether the user has verified their email address
emailstringidentityThe user's email address. It can change.
email_verifiedbooleanidentityThe same value as is_verified, under its OpenID Connect name
date_joinedstringprofileWhen the account was created, as an ISO 8601 timestamp
namestringidentity or profileThe display name. Absent when the user has not set one.
birthdatestringidentityThe date of birth, as YYYY-MM-DD. Absent when the user has not given one.
given_namestringprofileThe first name. Absent when the user has not set one.
middle_namestringprofileThe middle name. Absent when the user has not set one.
family_namestringprofileThe last name. Absent when the user has not set one.
nicknamestringprofileAbsent when the user has not set one.
websitestringprofileAn https URL. Absent when the user has not set one.
updated_atnumberprofileWhen the profile last changed, in seconds since the epoch
localestringA claims requestThe user's language. Returned only when you ask for it and the user approves (below).
picturestringprofileThe avatar URL. Always present with profile: a user with no uploaded avatar has a generated one.
genderstringprofilemale, female or prefer_not_to_say, as listed in the userinfo reference. Absent when the user has not answered.
banner_urlstringprofileThe banner URL. Absent when the user has not uploaded one.
<provider>objectsocials:<provider>The provider block, below

A token granted only openid returns sub and id and nothing else.

is_verified and email_verified are one fact under two names and never differ.

A provider block

One block per social provider scope the user granted, keyed by the provider's name:

{
  "github": {
    "scopes": ["read:user"],
    "data": { "…": "…" },
    "expired": false
  }
}
FieldMeaning
scopesThe provider's own scopes the user approved
dataWhat the provider returned. Its shape is the provider's.
expiredtrue when onefold could not refresh the provider's data, for example because the user revoked access at the provider. Treat data as stale.

Social login covers the supported providers and their configuration.

Claims in the ID token

The ID token carries less than userinfo: identification only.

ClaimPresent
sub, iss, aud, exp, iat, auth_timeAlways
acrAlways. "1" for a sign-in with one factor, "2" when the user also verified a second factor.
preferred_username, email, email_verifiedWith the identity scope
nonceWhen you sent one

Profile claims and provider blocks are never in the ID token. Read them from userinfo. Verify the ID token covers the checks to make.

The same claims in the management API

The management API returns the same claims for a user as userinfo does, limited to the scopes that user granted your application.

Request individual claims

To ask for a claim your scopes do not return, send the OpenID Connect claims parameter on the authorization request, naming the claim under userinfo:

{ "userinfo": { "locale": null } }

The user approves it on the consent screen together with the scopes, and userinfo then returns it. A user who approved an earlier request sees the consent screen again when a new request asks for a claim they have not approved. Only the userinfo member is read: the ID token's claims do not change, and a claim onefold does not serve is ignored.

The consent screen lists one line per requested scope, and the user approves or declines the request as a whole. A user cannot approve some scopes and decline others. openid and identity share one line, "Confirm your identity.", which the screen shows once.

Request only the scopes you use: each one is a line the user reads before deciding. See Consent screen.

On this page