latestOpenAPI 3.0.02026-08-1091020.6 KB

6db43b35bc50

oauth

Create authorization URL

Create an sgID authorization URL to redirect your user to so that they can authenticate with Singpass

get/v2/oauth/authorize

Query parameters

response_type'code' required
Example:code

Must be set to code because sgID only supports the authorization code flow

client_idstring required
Example:MYCLIENT-PROD

sgID client ID which was provided to you during client registration

redirect_uristring required
Example:https://example.com/callback

The callback URL that was provided during registration. sgID redirects to this URL with the authorization code after the user authenticates with Singpass

scopestring required
Example:openid%20myinfo.name%20myinfo.passport_expiry_date%20myinfo.nric_number

A URL-encoded string of the scopes your client will request for

noncestring
Example:BQO8SV3ALIYA808IZ8O7PKWRI8A8X6MI

Randomly generated string to be returned in the ID token. Used to prevent replay attacks as part of the OpenID Connect 1.0 spec

statestring
Example:tk39drykro3

A unique and non-guessable value associated with each authentication request about to be initiated. Used to prevent CSRF attacks and to maintain state as part of the OAuth 2.0 spec (RECOMMENDED)

code_challenge_methodstring required
Example:S256

The method used to verify the code challenge. Throws an error response if the value is not 'S256'

code_challengestring required
Example:CUZX5qE8Wvye6kS_SasIsa8MMxacJftmWdsIA_iKp3I

A SHA256 hashed string that should be used to verify against the code verifier in the token request

Response

A HTML page which contains a sgID QR code if the request is successful, or an error code and error message if there is a problem with the request.