POST v1/Token/OAuth2/AuthorizationCode

Validate OAUTH authorization code and return an Authorization token for a user.

Request Information

URI Parameters

None.

Body Parameters

OAuth2AuthTokenRequestModel
NameDescriptionTypeAdditional information
Domain

Name of the Domain

string

Required

AuthorizationCode

Cognito Authorization Code

string

Required

CodeVerifier

Cognito Code Verifier

string

Required

RedirectUri

Retun url of the application

string

Required

UserPoolWebClientId

Web Client Id

string

Required

Request Formats

application/json, text/json

Sample:
{
  "Domain": "sample string 1",
  "AuthorizationCode": "sample string 2",
  "CodeVerifier": "sample string 3",
  "RedirectUri": "sample string 4",
  "UserPoolWebClientId": "sample string 5"
}

application/xml, text/xml

Sample:
<OAuth2AuthTokenRequestModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Domain>sample string 1</Domain>
  <AuthorizationCode>sample string 2</AuthorizationCode>
  <CodeVerifier>sample string 3</CodeVerifier>
  <RedirectUri>sample string 4</RedirectUri>
  <UserPoolWebClientId>sample string 5</UserPoolWebClientId>
</OAuth2AuthTokenRequestModel>

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'OAuth2AuthTokenRequestModel'.

Response Information

Resource Description

AuthTokenResponseModel
NameDescriptionTypeAdditional information
Name

Midnight user Full Name

string

None.

access_token

Returns Access Token

string

None.

refresh_token

Returns Refresh Token

string

None.

token_type

Returns Token Type

string

None.

expires_in

Returns Token Expire Time

integer

None.

Response Formats

application/json, text/json

Sample:
{
  "access_token": "sample string 2",
  "refresh_token": "sample string 3",
  "token_type": "sample string 4",
  "expires_in": 5,
  "Name": "sample string 1"
}

application/xml, text/xml

Sample:
<AuthTokenResponseModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <access_token>sample string 2</access_token>
  <refresh_token>sample string 3</refresh_token>
  <token_type>sample string 4</token_type>
  <expires_in>5</expires_in>
  <Name>sample string 1</Name>
</AuthTokenResponseModel>