Closed Nubtehy closed 1 year ago
Hello, @Nubtehy 👋. Can you confirm that the user has been fully verified within the Cognito User Pool via the SMS or emailed verification code that's sent after signing up?
Hi @cwomack! I can provide you video record for confirmation if it is needed
@Nubtehy, that would be great! It sounds like the potential bug here is the LastAuthUser isn't being URI encoded and has a mismatch when you're trying to pass those cookies to the third party site. Is that what you're seeing or can show in the video recording?
I am having the same issue. I haven't touched a page I implemented a month ago. Now I am getting the user is not authenticated when using SSR. however Auth.currentAuthenticatedUser()
on the client side is working just fine.
@Nubtehy, any chance you could unarchive that video or post it again? It won't play any longer. I'd be happy to download it and save it if you wanted to it only be available short term!
Apologies I didn't do that sooner.
Awesome, thank you @Nubtehy!
Related to #7684
@Nubtehy after reviewing this further, it looks close enough to #7684 to call it a duplicate. As such, I'll close this down since the other issue is already in progress and leave a comment referencing your recording of the bug in action.
Greatly appreciate you providing that, and please follow the other issue for progress and updates on a fix!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
I'm using Cognito Authentication with Amplify in a next.js. I have case when third party site open page in my application. I've configured amplify with cookieStorage config, beacause only ssr: true. dosen't provide all cookies that need withSSRContext. when I open private page from third party website, I got the error The user is not authenticated. But user is authenticated. All cookies for cognito are provided.
My flow:
Expected behavior
when I open private page from third party website, I should see private page when my user is authenticated
Reproduction steps
Open private page with from third party website. Get the error
The user is not authenticated
Code Snippet
Log output
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
CognitoUser.js
const keyPrefix =
CognitoIdentityServiceProvider.${this.pool.getClientId()}.${ this.username }
; const idTokenKey =${keyPrefix}.idToken
; //idTokenKey= CognitoIdentityServiceProvider.**pdhmiepo.nubtehy@gmail.com.idTokenbut in store it looks like 'CognitoIdentityServiceProvider.**pdhmiepo.nubtehy%40gmail.com.idToken
store: [Object: null prototype] { 'CognitoIdentityServiceProvider.**pdhmiepo.nubtehy%40gmail.com.idToken':
this.username is returned from LastAuthUser and there it was saved without encodeURIComponent
When I use encodeURIComponent for userName here everything works correctly