Open newtriks opened 8 years ago
The flow you describe should be correct. There was a small issue in the past where doing multiple calls to refreshSession would overwrite the refresh token with an empty value even if there was no refresh token retrieved (calling refreshSession doesn't retrieve a new refresh token, it only retrieves an access token and an id token). This was fixed in the following pull request so it should work now unless it's a different problem.
Hi, does this issue still occur?
Sorry, this was a POC and I completed it a while back, AFAIK the issue persisted.
When I get the current user from local cache i.e.
user = userPool.getCurrentUser()
, I then attempt to get a session usinguser.getSession()
.This is throwing the following error in response to a POST request to
https://cognito-idp.eu-west-1.amazonaws.com/
:{"__type":"InvalidParameterException","message":"Missing required parameter REFRESH_TOKEN"}
Digging in the debugger it results from
aws-cognito-sdk.js:1280
where thehttpRequestBody
looks like:"{"ClientId":"my_client_id","AuthFlow":"REFRESH_TOKEN_AUTH","AuthParameters":{"REFRESH_TOKEN":"","DEVICE_KEY":"my_device_key"}}"
which is called by thegetSession
request inamazon-cognito-identity.js
.So, it appears the session has expired and requires renewing but how do I do this ideally without it throwing errors in the console by making this HTTP request which has a possibility of failing?
Should I by default renew the session prior to making this call?