Authorization Code Grant
Client Authentication - Client Assertion JWT
Assertion JWT Structure
The RP is required to generate an assertion JWT that has the following header and claims, and is signed with the JWK that was provided during onboarding.
JWT Header
The header must include alg
and typ
.
The supported alg
types are:
ES256
ES384
ES512
.
This must match the alg
value in the signing key used to sign the assertion (if the signing JWK specifies alg
explicitly).
The header should also include kid
of the signing key to help identify which of the RP’s signing keys was used, though this is not mandatory. If omitted, we will test against all known signing keys when attempting to verify the signature.
example
JWT Claims
Path | Type | Description |
---|---|---|
|
| This should be |
|
| The recipient that the JWT is intended for. This must match the |
|
| This should be |
|
| The time at which the JWT was issued. https://tools.ietf.org/html/rfc7519#section-4.1.6 |
|
| The expiration time on or after which the JWT MUST NOT be accepted by Singpass for processing. Additionally, Singpass will not accept tokens with an |
|
| (Optional) This should be the auth |
Request / Response Structure
Curl request
Form parameters
Parameter | Description |
---|---|
| The Client Identifier registered |
| The redirect URI being used in this auth session |
| The type of grant being requested. This must be set to |
| The code issued earlier in the auth session |
| (Optional) If no value is provided, it defaults to |
| This MUST be set to |
| A JWT identifying the client. |
| (Mandatory) This is the session-based, unique, and non-guessable value that the RP had used to generate the Must match |
HTTP request
HTTP response
Request body
Response body
Response fields
Path | Type | Description |
---|---|---|
|
| For Login flows, the access token will be a random string that is not to be used. For Myinfo flows, the token will be an encoded JSON Web Token (JWT). This token is to be used to exchange for payload at UserInfo Endpoint. |
|
| The type of token being requested, Bearer only so far. |
|
| The ID token with relevant claims in JWT format signed by the ASP. Note that the example response body shows a JWS (3-part structure separated by dots), but the format will differ for a JWS in JWE (5-part structure). Refer here for more details about the ID token structure. |
Error Response
Singpass generally follows OIDC error response specifications. For more information, please refer to Token Error Response specifications.
ID Token Structure
The format and structure of the issued ID Token will vary depending on the client’s profile as specified in this table below:
Client Profile |
| ID token format |
| UUID only (eg. | JWS |
| Regular NRIC holders: NRIC and UUID (eg. Singpass Foreign Account (SFA) holders: Singpass User ID (UID), Foreigner ID (FID), Country-of-Issuance (COI) and UUID (eg. This class of users were previously known as "Foreign Unique Account" or "Singpass Foreign Unique Account" users. Only designated relying parties are able to have SFA users authenticate & complete token exchange. | JWS in JWE (encrypted with client’s JWK) See section below for more details about the JWE format. |
| NRIC and UUID (eg. | JWS |
Overview of a JWS in JWE
An encrypted ID token will returned from the /token
endpoint is a JWS in JWE that is in compact serialization form. It has the following structure:
JWE Header
Encrypted Key
Initialization Vector
Encrypted Payload (if decrypted, this would be the Base64 encoded form of a JWS ID Token)
Authentication Tag
See https://datatracker.ietf.org/doc/html/rfc7516#section-3.1 for more details.
JWE Header
The JWE will contain these standard headers. Refer to https://tools.ietf.org/html/rfc7515#section-4 for more information about each header.
Note: Relying parties should use the
kid
field in the header to determine which key NDI used for encryption.
example
Overview of JWS
The JWS ID token returned from the /token
endpoint is in compact serialization form. A JWS has the following structure.
JWS Header
Payload (containing claims)
Signature
JWS Header
The JWS ID token will contain these standard headers. Refer to https://tools.ietf.org/html/rfc7515#section-4 for more information about each header.
example
JWS Claims
The JWS ID token will contain the following claims.
example
Table 1. Description of Claims
Path | Type | Description |
---|---|---|
|
| The principal that is the subject of the JWT. Contains a comma-separated, key=value mapping that identifies the user; possibly including multiple alternate IDs representing the user. The keys included vary by the profile of the OIDC client, and the user type, however the minimal format is |
|
| The client_id of the relying party. https://tools.ietf.org/html/rfc7519#section-4.1.3 |
|
| The principal that issued the JWT. https://tools.ietf.org/html/rfc7519#section-4.1.1 |
|
| The time at which the JWT was issued. https://tools.ietf.org/html/rfc7519#section-4.1.6 |
|
| The expiration time on or after which the JWT MUST NOT be accepted for processing. Defaults to 10 minutes since "iat". https://tools.ietf.org/html/rfc7519#section-4.1.4 |
|
| Authentication method references. Example values are |
|
| String value used to associate a Client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified from the Authentication Request to the ID Token. Clients MUST verify that the nonce Claim Value is equal to the value of the nonce parameter sent in the Authentication Request. https://openid.net/specs/openid-connect-core-1_0.html#IDToken |
|
| (Optional) The Authentication Context Class Reference. The values are context-specific and agreed upon between NDI and relying parties when used. |
Last updated