You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the implicit grant flow (Amplify configured with Auth.oauth.responseType = 'token'), after redirection from Cognito Hosted UI the idToken and accessToken are correctly populated, refreshToken stays empty - as it is supposed to be:
After one hour, when the tokens expire, the wrong behaviour comes to the scene. Calling Auth.currentSession() will result in fetching the user session (Auth.ts:851 -> CognitoUser.js:1117) which I think contains the bad code. It loads the tokens from the localStorage and performs the validity (expiry) check (CognitoUser.js:1151).
It finds out that the session has expired and checks if the refreshToken == null (CognitoUser.js:1156) in order to use it for the token refresh process. This is the wrong part. As you can see in the picture above, the refreshToken is not null but rather an empty string. This means that the check passes and the refresh token (the empty string) is used in the token endpoint call - and that results in a 400 - Bad Request ({"__type":"InvalidParameterException","message":"Missing required parameter REFRESH_TOKEN"}).
What is the expected behavior?
The check for refreshToken in the CognitoUser.js:1156 file should resolve to false and thus the call to the token endpoint should not be performed.
Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions?
I'm using latest Chrome (Version 67.0.3396.99 (Official Build) (64-bit)) on Mac and latest Amplify version from npm (0.4.8).
The text was updated successfully, but these errors were encountered:
Bug
Auth.oauth.responseType = 'token'
), after redirection from Cognito Hosted UI theidToken
andaccessToken
are correctly populated,refreshToken
stays empty - as it is supposed to be:Auth.currentSession()
will result in fetching the user session (Auth.ts:851 -> CognitoUser.js:1117) which I think contains the bad code. It loads the tokens from the localStorage and performs the validity (expiry) check (CognitoUser.js:1151).refreshToken == null
(CognitoUser.js:1156) in order to use it for the token refresh process. This is the wrong part. As you can see in the picture above, therefreshToken
is notnull
but rather an empty string. This means that the check passes and the refresh token (the empty string) is used in the token endpoint call - and that results in a 400 - Bad Request ({"__type":"InvalidParameterException","message":"Missing required parameter REFRESH_TOKEN"}
).The check for
refreshToken
in the CognitoUser.js:1156 file should resolve tofalse
and thus the call to the token endpoint should not be performed.I'm using latest Chrome (Version 67.0.3396.99 (Official Build) (64-bit)) on Mac and latest Amplify version from npm (0.4.8).
The text was updated successfully, but these errors were encountered: