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
After a user is created and logs in for the first time, using the temporary password, and sets up the new password and fills in the required attributes, then the user is redirected back to the app (to the redirect_uri). However the uri is appended with some querystring which causes the amplify library to fail parsing the uri to get the token information which are located behind the # sign in the uri. The only solution is to either manually remove the querystring or login again using the Hosted UI.
Use the Implicit flow grant with Cognito Hosted UI and a Javascript client app
Create a user in the user pool
Sign in for the first time as the user using Hosted UI - fill in a new password and required attributes
The CognitoCloudFrontEndpoint and CognitoCloudFrontVersion and others are added extra as opposed to the scenario when you already have a valid user and just log in. If you log in again, the uri looks like this:
Notice that there is no querystring (anything that would begin with the ? sign).
Now the failing part of the code is in the file Auth.ts:176 where the uri check is being performed. This then utilizes the amazon-cognito-auth-js module, more specifically the CognitoAuth.js:265 file and linked method. That checks for the uri pattern and when it finds the ? sign, it assumes the authorization flow is Authorization code. Which it is not, so it fails to parse the uri properly.
What is the expected behavior?
The uri gets properly parsed even though it contains some querystring. The code should not only check for the presence of the ? sign, but also other required parameters for the Authorization code grant flow.
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 (1.0.2).
PS: This is probably more more of a bug in the amazon-cognito-auth-js module, but since I'm using Amplify which uses the provided library as a dependency, I think the issue belongs here. If not, I'm happy to create one for the amazon-cognito-auth-js repo as well, so please let me know. Thank you!
The text was updated successfully, but these errors were encountered:
Okay so I tried this again today, repeating the exact steps as on Friday when I posted this issue, and it works fine now. After redirection from the Hosted UI, the querystring is not there any more and so the uri is parsed correctly. Have there been some adjustments made on the Cognito side?
Hello everyone, we have created an RFC for feature work that should make the challenges found in this issue easier in the future. If you have a moment please read through the details and add any comments: #2716
Your feedback in the RFC will help us ensure that we are delivering the best experience possible. Thank you.
Bug
After a user is created and logs in for the first time, using the temporary password, and sets up the new password and fills in the required attributes, then the user is redirected back to the app (to the
redirect_uri
). However the uri is appended with some querystring which causes the amplify library to fail parsing the uri to get the token information which are located behind the#
sign in the uri. The only solution is to either manually remove the querystring or login again using the Hosted UI.The
CognitoCloudFrontEndpoint
andCognitoCloudFrontVersion
and others are added extra as opposed to the scenario when you already have a valid user and just log in. If you log in again, the uri looks like this:Notice that there is no querystring (anything that would begin with the
?
sign).Now the failing part of the code is in the file Auth.ts:176 where the uri check is being performed. This then utilizes the amazon-cognito-auth-js module, more specifically the CognitoAuth.js:265 file and linked method. That checks for the uri pattern and when it finds the
?
sign, it assumes the authorization flow is Authorization code. Which it is not, so it fails to parse the uri properly.The uri gets properly parsed even though it contains some querystring. The code should not only check for the presence of the
?
sign, but also other required parameters for the Authorization code grant flow.I'm using latest Chrome (Version 67.0.3396.99 (Official Build) (64-bit)) on Mac and latest Amplify version from npm (1.0.2).
PS: This is probably more more of a bug in the amazon-cognito-auth-js module, but since I'm using Amplify which uses the provided library as a dependency, I think the issue belongs here. If not, I'm happy to create one for the amazon-cognito-auth-js repo as well, so please let me know. Thank you!
The text was updated successfully, but these errors were encountered: