How to get Google Refresh Token from AWS Cognito?

Viewed 646

I already read some topics here

  1. AWS cognito - Is it possible to get google access token and refresh using aws access token when sign in using google in from aws cognito
  2. https://github.com/aws-amplify/amplify-js/issues/3619.

The first one said I can't get Google Refresh Token from AWS Cognito.

The second one said AWS Cognito auto refresh Google Access Token and return to me when I call refresh AWS Cognito token.

So what is true?

I try to mapping Google Access Token and Refresh Token by using this

https://medium.com/graymatrix/using-custom-attributes-in-amazon-cognito-user-pool-288cd3128bae

After that i only get Google Access Token without Google Refresh Token.

Can someone tell me how to get Google Refresh Token from AWS Cognito? Or the official AWS document on this issue.

1 Answers

I was facing the same problem: I use Google as federated ID provider and I only got an access token back. Tried different auth flows, read pages over pages of documentation. I finally found (by trial and error): Disable the implicit grant in the user pool. Then Cognito starts sending the refresh token. You then have to use the authorization code grant flow, of course. But that's rather simple using a library such as oauth2-pkce.

Related