Obtaining new Access and Refresh Token in case of Device Authorization Grant with AWS Cognito

0

We are implementing the Device Authorization Grant with AWS Cognito using the information provided in this AWS Blog - Implement OAuth 2.0 device grant flow by using Amazon Cognito and AWS Lambda. Related to this setup, what is the way to get a new access token and refresh token using the current refresh token? What is the endpoint to which the request has to be sent? A sample request and response for this flow would be helpful.

Pradhan
feita há um mês58 visualizações
2 Respostas
1

Thank you, @Osvaldo Marte.

Request:

curl --location 'https://{your-cognito-domain}.auth.{aws-region}.amazoncognito.com/oauth2/token' \
--header 'Authorization: Basic {Base64Encode(client_id:client_secret)}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'refresh_token={your_refresh_token}'

The response will be:

{
    "id_token": "{id_token}",
    "access_token": "{access_token}",
    "expires_in": 3600,
    "token_type": "Bearer"
}
Pradhan
respondido há um mês
0
Resposta aceita

You need to send a POST request with your refresh token to the Cognito token endpoint.

ℹ️ In the previous link you will find some examples of requests and responses

profile picture
ESPECIALISTA
respondido há um mês

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas