Configure the Client to Call Identity Authentication Token Endpoint for Resource Owner Password Credentials Flow
The token endpoint is used to get the user's access token, id token and refresh token.
This document explains how to call the token endpoint and what are the parameters supported by Identity Authentication.
URI:https://<Cloud Identity Services domain>/oauth2/token
The domain part has the following pattern:
<tenant ID>.accounts.ondemand.com
or<tenant ID>.accounts.cloud.sap
. If you have a configured custom domain, the domain has the following pattern: <your custom domain>.Tenant ID is an automatically generated ID by the system. The first administrator created for the tenant receives an activation email with a URL in it. This URL contains the tenant ID. For more information about your tenants, see View Assigned Tenants and Admins.
**HTTP Method:**POST
Header |
Required |
Values |
---|---|---|
|
Yes |
application/x-www-form-urlencoded |
|
No |
|
Parameter |
Required |
Data Type |
Additional Information |
Parameter Type |
---|---|---|---|---|
|
Yes |
string |
The supported value is |
Request body |
|
Yes |
string |
The user identifier. |
Request body |
|
Yes |
string |
The user password, and the one-time password (OTP) generated by the user's registered device if the application is configured to require two-factor authentication.
|
Request body |
|
No
|
|
Used to identify the corresponding Identity Authentication application. |
Request body |
|
No |
string |
Reduces the expiration of a refresh token. It's useful if your application is called from mobile and web applications, and both have different session requirements. If you set the token lifetime to 0, you won't receive a |
Request body |
|
No |
string |
You can set а limit on how long the application can exchange user tokens without reauthenticating after having acquired the initial token. The
|
Request body |
|
No |
string |
The |
Request body |
|
No |
string |
Reserved. |
Request body |
|
No |
string |
Value must be space deliminated parameter, for example: The supported values are:
|
Request body |
grant_type=password&username=<user identifier>&password=<user password>[<otpcode>]
Code |
Result or X-Message Code |
Description |
---|---|---|
200 OK |
Successful operation. |
Returns
|
400 Bad Request |
Missing or wrong parameter. |
Returns an information about the error. |
401 Unauthorized |
Wrong user ID or password parameters passed for the basic authentication. For more information, see Configure Secrets for API Authentication. |
The authentication of the client (relying party) failed. |
PASSWORD_CHANGE_REQUIRED |
When the user must change his or her password before logon. |
|
INITIAL_PASSWORD_EXPIRED |
When the initial password of the user has expired. After the validity of the initial password expires, the user can't log on to the application and must contact the administrator. |
{
"access_token": "387qb8bc-7t78-4eb8-8a8c-cfbe31860811",
"refresh_token": "d12a12abcd198765dd54r456e98321"
"id_token":
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxMmEzNGI1Yy02ZDc4LTll
MWYtZzM0NS02N2g4OWlqa2wxMjMiLCJzdWIiOiJQMTIzNDU2IiwibWFpbCI6ImRvbmEubW
9vcmVAZXhhbXBsZS5jb20iLCJpc3MiOiJodHRwczovL215LXRlbmFudC5hY2NvdW50cy5v
bmRlbWFuZC5jb20iLCJsYXN0X25hbWUiOiJNb29yZSIsInNhcF91aWQiOiIxMjM0NTZhYmM
3ZGU4LWZnaGktOTEyMy1qNDU2LTc4OTEya2wzNG01NiIsImV4cCI6MTU4ODAxODkyNSwiaW
F0IjoxNTg4MDEzNzYwLCJmaXJzdF9uYW1lIjoiRG9uYSIsImp0aSI6IjM4ZTQyMzMwLWRlN
2EtNDEzMC1hM2ExLWI1ODJiNTI4ZGE5OCJ9.-LSwBN2WSqnnqSkzSbg9iRmtAMR4moU5TpE
40mX0Umwg",
"token_type": "Bearer",
"expires_in": 300
}
The format of the
issuer
depends on the configuration in the administration console for SAP Cloud Identity Services. For more information, see Tenant OpenID Connect Configurations.