Available in Classic and VPC
This section describes how to integrate registered applications with Single Sign-On. Integration is carried out through the integration API provided by Single Sign-On. The features provided by the Single Sign-On integration API are as follows:
- Grant permissions
- Issue tokens
- Cancel tokens
- Return authenticated user claims
- Return ID token signature key
- Before using the Single Sign-On integration API, it is recommended to learn the key concepts related to OAuth 2.0 in Single Sign-On concepts.
- This section describes only the APIs used for Single Sign-On integrations. For a complete description of the APIs provided by Single Sign-On on the NAVER Cloud Platform, see Single Sign-On API guide.
Grant permissions
This section describes the APIs required to interact with the resource owner and obtain permissions to access protected resources.
Requests
The request sent by the client to the IDP to access protected resources is as follows:
GET /tenants/{Tenant Id or Alias}/oauth2/authorize
-
Request path
Parameter name Type Requirement status Restrictions Description Tenant Id or AliasString Required - Tenant ID or tenant alias issued when creating a tenant -
Request parameters
Parameter name Type Requirement status Restrictions Description response_typeString Required codeortokenValues required when proceeding with the authorization code or implicit flow client_idString Required - Client ID issued when registering the application redirect_uriString Required Must match the redirect URI entered when registering the application The URL of the page you will be directed to after granting permissions scopeString Required - Accessible scope. To request additional scopes, include one or more scope values separated by a space. stateString Optional - A random value for CSRF defense. After granting state permissions, go to the page entered in redirect_uri, including the state valuecode_challengeString Optional - The value of the code challenge required when applying PKCE code_challenge_methodString Optional plainorS256The value of the code challenge method required when applying PKCE
See below for an example.
-
If
response_typeiscodeGET /tenants/{Tenant Id or Alias}/oauth2/authorize?client_id=${Client Id}&scope=${Scope}&response_type=code&redirect_uri=${Redirect URI}&state=${State} HTTP/1.1 Host: sso.ncloud.com -
If you requested permissions by adding
code_challengeandcode_challenge_methodGET /tenants/{Tenant Id or Alias}/oauth2/authorize?client_id=${Client Id}&scope=${Scope}&response_type=code&redirect_uri=${Redirect URI}&state=${State}&code_challenge=${Code Challenge}&code_challenge_method=${Code Challenge Method} HTTP/1.1 Host: sso.ncloud.com -
If
response_typeistokenGET /tenants/{Tenant Id or Alias}/oauth2/authorize?client_id=${Client Id}&scope=${Scope}&response_type=token&redirect_uri=${Redirect URI}&state=${State} HTTP/1.1 Host: sso.ncloud.com
Response
The response to the request is as follows:
-
If
response_typeiscodeHTTP/1.1 302 Found Location: {Redirect URI} ?code=${Authorization code} &state=${State}Parameter name Type Requirement status Restrictions Description redirect_uriString Required redirect_uriincluded in the requestThe URL of the page you will be directed to after granting permissions codeString Required Expires after 1 minute to prevent the risk of leakage Authorization code generated by the IDP stateString Optional - Value requested by the client -
If
response_typeistokenHTTP/1.1 302 Found Location: {Redirect URI} ?access_token={Access Token} &token_type=Bearer &expires_in={Access Token Expire Date} &state={State}Parameter name Type Requirement status Restrictions Description redirect_uriString Required redirect_uriincluded in the requestThe URL of the page you will be directed to after granting permissions access_tokenString Required - Permission granted access token expires_inNumber Required - Access token's validity period stateString Optional - Value requested by the client
Issue tokens
Describes the API necessary to obtain a token for credentials after access permissions have been granted.
Requests
After granting permissions or using a refresh token, the request sent to obtain an access token or ID token is as follows:
POST /tenants/{Tenant Id or Alias}/oauth2/token
-
Request path
Parameter name Type Requirement status Restrictions Description Tenant Id or AliasString Required - Tenant ID or tenant alias issued when creating a tenant -
Request headers
Header name Type Requirement status Restrictions Description AuthorizationString Required Basic Base64 Client identifier Content-TypeString Required application/x-www-form-urlencodedMedia type of the resource -
Request parameters
Parameter name Type Requirement status Restrictions Description grant_typeString Required authorization_codeorrefresh_tokenToken return method codeString Optional Use this if grant_typeisauthorization_codeAuthorization code delivered by IDP redirect_uriString Optional Use this if grant_typeisauthorization_coderedirect_uriincluded in the permission grant requestscopeString Optional Use this if grant_typeisrefresh_tokenscopeto editcode_verifierString Optional Used if grant_typeisauthorization_code, and it must be equal to or smaller than thescopepreviously grantedValues corresponding to code_challenge,code_challenge_methodincluded in the permission request
See below for an example.
-
When requesting the issuance of an access token including the authorization code after permission has been granted
POST /tenants/{Tenant Id or Alias}/oauth2/token HTTP/1.1 Host: sso.ncloud.com Authorization: Basic Base64(${Client Id}:${Client Secret}) Content-Type: application/x-www-form-urlencoded grant_type=authorization_code&code=${Authorization code}&redirect_uri=${Redirect URI} -
If
code_verifieris included in the access token issuance request after granting permissionsPOST /tenants/{Tenant Id or Alias}/oauth2/token HTTP/1.1 Host: sso.ncloud.com Authorization: Basic Base64(${Client Id}:${Client Secret}) Content-Type: application/x-www-form-urlencoded grant_type=authorization_code&code=${Authorization code}&redirect_uri=${Redirect URI}&code_verifier=${Code Verifier} -
When requesting an access token with a refresh token
POST /tenants/{Tenant Id or Alias}/oauth2/token HTTP/1.1 Host: sso.ncloud.com Authorization: Basic Base64(${Client Id}:${Client Secret}) Content-Type: application/x-www-form-urlencoded grant_type=refresh_token&refresh_token=${Refresh Token}&scope=${Scope}
Response
The response to the request is as follows:
{
"access_token": "String",
"token_type": "Bearer",
"expires_in": "Number",
"refresh_token": "String"
}
| Parameter name | Type | Requirement status | Restrictions | Description |
|---|---|---|---|---|
access_token |
String | Required | - | Permission granted access token |
token_type |
String | Required | Bearer | Type of token |
expires_in |
Number | Required | - | Access token's validity period |
refresh_token |
String | Required | - | Value of refresh token used when issuing access token |
Cancel tokens
Describes the API required to revoke an access token or refresh token.
Requests
The request to revoke an access token or refresh token is as follows:
POST /tenants/{Tenant Id or Alias}/oauth2/revoke
-
Request path
Parameter name Type Requirement status Restrictions Description Tenant Id or AliasString Required - Tenant ID or tenant alias issued when creating a tenant -
Request headers
Header name Type Requirement status Restrictions Description AuthorizationString Required Basic Base64 Client identifier Content-TypeString Required application/x-www-form-urlencodedMedia type of the resource -
Request parameters
Parameter name Type Requirement status Restrictions Description tokenString Required - The token to be revoked token_type_hintString Required access_tokenorrefresh_tokenThe type of the token to be revoked
Response
The response to the request is as follows:
{
"status": "ok"
}
Return authenticated user claims
Describes the API required to return claims for authenticated users.
Requests
The request to return a user claim is as follows:
POST /tenants/{Tenant Id or Alias}/oauth2/userinfo
-
Request path
Parameter name Type Requirement status Restrictions Description Tenant Id or AliasString Required - Tenant ID or tenant alias issued when creating a tenant -
Request headers
Header name Type Requirement status Restrictions Description AuthorizationString Required Bearer Client identifier
Response
The response to the request is as follows:
{
"sub" : "String",
"id_no" : "String",
"user_type" : "String",
"user_id": "String",
"user_name" : "String",
"mbr_no" : "Number"
"groups" : "List"
}
| Parameter name | Type | Requirement status | Restrictions | Description |
|---|---|---|---|---|
sub |
String | Required | - | Subject (end-user) identifier |
id_no |
String | Required | - | The user identifier used in NAVER Cloud Platform |
user_type |
String | Required | Customer or Sub |
User type |
user_id |
String | Required | - | Login ID |
user_name |
String | Required | - | User name |
mbr_no |
Number | Required | - | User's member number |
groups |
List | Optional | - | The list of group names to which a sub account belongs when the user_type is Sub |
Return ID token signature key
Describes the API required to return the public key used to sign the ID token.
Requests
The request to send to return the public key used to sign the ID token is as follows:
GET /tenants/{Tenant Id or Alias}/oauth2/jwks
-
Request path
Parameter name Type Requirement status Restrictions Description Tenant Id or AliasString Required - Tenant ID or tenant alias issued when creating a tenant
Response
The response to the request is as follows:
{
"keys" : [ {
"kty" : "String",
"e" : "String",
"kid" : "String",
"n" : "String"
} ]
}
| Parameter name | Type | Requirement status | Restrictions | Description |
|---|---|---|---|---|
kty |
String | Required | - | Refer to IETF Datatracker's Key Type |
e |
String | Required | - | Refer to IETF Datatracker's RSA Exponent |
kid |
String | Required | - | Refer to IETF Datatracker's Key ID |
n |
String | Required | - | Refer to IETF Datatracker's RSA Modulus |
Endpoint
The API endpoint is as follows:
| Endpoint | URI Path | Description |
|---|---|---|
| Authorization Endpoint | /tenants/{Tenant Id or Alias}/oauth2/authorize |
The client requests grant permissions to interact with the resource owner and access protected resources |
| Token Endpoint | /tenants/{Tenant Id or Alias}/oauth2/token |
Issue access token and ID token through access permission or refresh token |
| Token Revocation Endpoint | /tenants/{Tenant Id or Alias}/oauth2/revoke |
Cancel the access token or refresh token |
| User Info Endpoint | /tenants/{Tenant Id or Alias}/oauth2/userinfo |
Return authenticated user claims |