New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amplify runWithAmplifyServerContext not working with existing userpools not generated by amplify #12516
Comments
Hi @Sizlers thanks for trying out the Next.js adapter. Have you configured Amplify on the client side specifying the "SSR" use case? Amplify.configure({
... // your Amplify config object
}, {
ssr: true, // instruct the client to using cookie store storing auth tokens
}) If you have done so, could you check if the tokens are presented in the cookie store? Also check the requests sent out to your Next.js server, have |
@Sizlers, can you also clarify how the Auth resources were created (i.e. through Cognito Console, were existing from previous app, etc) when you say they were not generated via amplify? Thanks! |
I have the same problem, I checked the cookie is not in the cookie store, even though the |
Hi @adithep in what sign in flow you are seeing this issue? You mentioned |
Same problem to me y Nextjs with SSR: This function doesnt work:
Neither this one:
The error is the same to me: NotAuthorizedException: Unauthenticated access is not supported for this identity pool. |
@Sizlers and @adithep, circling back to this issue now that we're well past the pre-release versions of v6. Have either of you tried to upgrade to the most recent versions of Amplify v6 and see if you're still experiencing this issue? @rallona, the v6 |
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue. Thank you! |
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
When I use an existing cognito userpool/client app everything works as expected on the client side, being able to log in/register/sign out.
However the session is not getting picked up in NextJS's middleware.
Adding auth through amplify works as expected however and the session is getting passed through to the middleware.
On the amplify userpool, I then created a app client with the default settings:
Settings:
App type: Public Client
App client name: test-client
Client secret: Don't generate a client secret
Authentication flows: ALLOW_USER_SRP_AUTH
Authentication flow session duration: 3 minutes
Refresh token expiration: 30 days
Access token expiration: 60 minutes
ID token expiration: 60 minutes
Enable token revocation: true
Prevent user existence errors: true
Then plugged in that application client, and the issue returns.
Expected behavior
runWithAmplifyServerContext to detect session with userpools not generated through amplify
Reproduction steps
Install the following project: https://github.com/nadetastic/amplify-v6-ssr-dev-preview
Add a pre-existing userpool client pool via the config which wasn't generated via amplify.
Register then login on the client side
See session not getting picked up on the serverside
Code Snippet
// Put your code below this line.
Log output
aws-exports.js
No response
Manual configuration
{
"aws_cognito_region": "eu-west-2",
"aws_user_pools_id": "eu-west-2_Nxov6QmH3",
"aws_user_pools_web_client_id": "5kn63dvgueufnhoi88r05vurl5",
}
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
No response
The text was updated successfully, but these errors were encountered: