JWT Access Token
Claims in JWT Access Token
Last updated
Was this helpful?
Claims in JWT Access Token
Last updated
Was this helpful?
You can enable the issuing of JWT as an access token in the configuration page of your Application in the Authgear Portal.
This JWT contains several claims that describe your user and your application. The JWT access token that Authgear generates contains claims that are designed specifically for Authgear. Also, it may or may not include some standard JWT claims by default.
In this section, we'll list all the claims in the JWT access token by default and explain each claim.
The following code shows an example of the claims in a JWT access token from Authgear:
client_id
: this claim contains the client ID for your Authgear application. This is helpful when the aud
claim contains your project's endpoint.
https://authgear.com/claims/user/is_verified
: the value for this claim is a boolean that tells if the user is considered verified or not. You can configure the condition of such consideration in Authgear portal. If your project has both email and phone enabled, you can see this settings in Authentication > Login Methods > Verification > Configure how a user should be verified > isVerified is true when...
In addition to the above claims, you can add extra claims such as a user's name and email to the JWT access token using JavaScript Hook.
aud
: the aud claim stands for "audience" and its value specifies the recipient of the JWT - . In Authgear, the value for aud
is the endpoint for your Authgear project. E.g. https://my-project.authgear.cloud
. However, in ID Token, the value for aud
is the client ID.
exp
: exp claim stands for expiration. The value in this claim defines the time on or after which the token should expire and not be accepted for any processing - .
https://authgear.com/claims/user/can_reauthenticate
: this claim returns true if a user can and false if they can't. For example, a user with only Google sign-in can not re-authenticate while a user with a password can re-authenticate. This claim can help developers check before they call reauthenticate()
in Authgear SDK.
https://authgear.com/claims/user/is_anonymous
: this claim tells that a user is an anonymous user when the value is true
. You can from the Authgear Portal.
iat
: iat stands for "issued at". The value of the iat
claim is the time the JWT was issued - .
iss
: iss stands for issuer. This claim identifies the principal that issued the JWT - . For Authgear, the value of the iss
claim is the endpoint of your project.
jti
: jti stands for "JWT ID". It is a unique identifier for the JWT access token - .
sub
: sub is short for "subject" and it is a standard field in OIDC. The value is the user's unique ID generated by Authgear. You can use this user ID to generate a which you can then use in Admin API to query a user or perform mutations.
For a more detailed step, see this post on .