1

I´m new to AWS cognito identity provider and I´m trying to workaround an issue where an app becomes "unresponsive" after one hour.

I´ve already tracked down the following exception:

Invalid login token. Token Expired xxx > yyy

That being said, I´m trying to use a refresh token to update my id/access tokens.

I´m trying to use the following method:

http://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminInitiateAuth.html

new AWS.CognitoIdentityServiceProvider({ apiVersion: '2016-04-18' }).adminInitiateAuth(params,cb)

where I´m sending the following as params:

    {  
   "AuthFlow":"REFRESH_TOKEN_AUTH",
   "ClientId":"xxx",
   "UserPoolId":"ap-northeast-2_7wGKApTQV",
   "AuthParameters":{  
      "REFRESH_TOKEN":"ommited, but valid",
      "USERNAME":"luizhenrique.rolim@gmail.com"
   }
}

However, I get the following error, along with a null AuthenticationResultType object

code:"CredentialsError"
message:"No credentials to load"
  1. Am I on the right path for refreshing the idtoken?
  2. Why is my call to adminInitiateAuth failing?

Thanks

  • Just curious, did you get it working? I am wondering the same thing! Thanks! – chapeljuice Aug 23 '17 at 22:23
  • hey, @chapeljuice. Yes. There were 2 issues, one of them I could use another method: InitiateAuth, instead of adminInitiateAuth. I blame amazon documentation, cause they call "developer" guide, as if we were supposed to understaand this is not meant to "developers audience" but rather users which have a developer role. I answered this part here: https://stackoverflow.com/questions/45474045/aws-using-refresh-token-javascript/45516372#45516372 Second thing, I updated the aws-sdk on my my project which was extremel outdated (2.5.0 --> 2.95.0) Then it worked fine. – Luiz Henrique Martins Lins Rol Aug 25 '17 at 13:45

0 Answers0