Creates and returns access and refresh tokens for clients that are authenticated using client secrets. The access token can be used to fetch short-lived credentials for the assigned AWS accounts or to access application APIs using bearer
authentication.
POST /token HTTP/1.1
Content-type: application/json
{
"clientId": "string
",
"clientSecret": "string
",
"code": "string
",
"codeVerifier": "string
",
"deviceCode": "string
",
"grantType": "string
",
"redirectUri": "string
",
"refreshToken": "string
",
"scope": [ "string
" ]
}
URI Request Parameters
The request does not use any URI parameters.
Request BodyThe request accepts the following data in JSON format.
The unique identifier string for the client or application. This value comes from the result of the RegisterClient API.
Type: String
Required: Yes
A secret string generated for the client. This value should come from the persisted result of the RegisterClient API.
Type: String
Required: Yes
Used only when calling this API for the Authorization Code grant type. The short-lived code is used to identify this authorization request.
Type: String
Required: No
Used only when calling this API for the Authorization Code grant type. This value is generated by the client and presented to validate the original code challenge value the client passed at authorization time.
Type: String
Required: No
Used only when calling this API for the Device Code grant type. This short-lived code is used to identify this authorization request. This comes from the result of the StartDeviceAuthorization API.
Type: String
Required: No
Supports the following OAuth grant types: Authorization Code, Device Code, and Refresh Token. Specify one of the following values, depending on the grant type that you want:
* Authorization Code - authorization_code
* Device Code - urn:ietf:params:oauth:grant-type:device_code
* Refresh Token - refresh_token
Type: String
Required: Yes
Used only when calling this API for the Authorization Code grant type. This value specifies the location of the client or application that has registered to receive the authorization code.
Type: String
Required: No
Used only when calling this API for the Refresh Token grant type. This token is used to refresh short-lived tokens, such as the access token, that might expire.
For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see Considerations for Using this Guide in the IAM Identity Center OIDC API Reference.
Type: String
Required: No
The list of scopes for which authorization is requested. This parameter has no effect; the access token will always include all scopes configured during client registration.
Type: Array of strings
Required: No
HTTP/1.1 200
Content-type: application/json
{
"accessToken": "string",
"expiresIn": number,
"idToken": "string",
"refreshToken": "string",
"tokenType": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
A bearer token to access AWS accounts and applications assigned to a user.
Type: String
Indicates the time in seconds when an access token will expire.
Type: Integer
The idToken
is not implemented or supported. For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see Considerations for Using this Guide in the IAM Identity Center OIDC API Reference.
A JSON Web Token (JWT) that identifies who is associated with the issued access token.
Type: String
A token that, if present, can be used to refresh a previously issued access token that might have expired.
For more information about the features and limitations of the current IAM Identity Center OIDC implementation, see Considerations for Using this Guide in the IAM Identity Center OIDC API Reference.
Type: String
Used to notify the client that the returned token is an access token. The supported token type is Bearer
.
Type: String
For information about the errors that are common to all actions, see Common Errors.
You do not have sufficient access to perform this action.
HTTP Status Code: 400
Indicates that a request to authorize a client with an access user session token is pending.
HTTP Status Code: 400
Indicates that the token issued by the service is expired and is no longer valid.
HTTP Status Code: 400
Indicates that an error from the service occurred while trying to process a request.
HTTP Status Code: 500
Indicates that the clientId
or clientSecret
in the request is invalid. For example, this can occur when a client sends an incorrect clientId
or an expired clientSecret
.
HTTP Status Code: 401
Indicates that a request contains an invalid grant. This can occur if a client makes a CreateToken request with an invalid grant type.
HTTP Status Code: 400
Indicates that something is wrong with the input to the request. For example, a required parameter might be missing or out of range.
HTTP Status Code: 400
Indicates that the scope provided in the request is invalid.
HTTP Status Code: 400
Indicates that the client is making the request too frequently and is more than the service can handle.
HTTP Status Code: 400
Indicates that the client is not currently authorized to make the request. This can happen when a clientId
is not issued for a public client.
HTTP Status Code: 400
Indicates that the grant type in the request is not supported by the service.
HTTP Status Code: 400
For more information about using this API in one of the language-specific AWS SDKs, see the following:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4