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
Nextjs middleware and social Google login #13056
Comments
+1 |
Hi @Maayanyeru123 @hasadata thanks for opening this issue. Looking at @Maayanyeru123 's configuration, I anticipate you are calling |
adding the import fixed the issue |
Thanks for the confirmation, @hasadata. @Maayanyeru123, let us know if it resolves it for you as well. |
Not for me :) probably something I am missing here. |
I fixed it with an ugly hack i created a middle page called redirect but this is so ugly |
@Maayanyeru123, would you mind sharing the hacky way that you had to work around this? Wondering if we can provide any suggestions on it if you can share the frontend code. Thanks! |
Hey,
The |
Can you share please more on how did call the Redirect. Im facing the same issue. It'll be helpful to me |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication, GraphQL API, Storage
Amplify Version
v6
Amplify Categories
auth
Backend
Amplify CLI
Environment information
Describe the bug
When using NextJs middleware as stated in Amplify documentation after signing in with Google provider "await fetchAuthSession"
Doesn't return the signing user
Expected behavior
Getting the signing user session
Reproduction steps
1, going to app Home page
2. login with Google account
3. Going to Home
4. returns to sign in as user is not authenticated
Code Snippet
aws-exports.js
serverUtils.ts
layout.tsx
middleware.ts
SocialLoginButton.tsx
Log output
aws-exports.js
/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.
const awsmobile = {
"aws_project_region": "eu-west-1",
"aws_cognito_identity_pool_id": "XXXX",
"aws_cognito_region": "eu-west-1",
"aws_user_pools_id": "XXXXX",
"aws_user_pools_web_client_id": "XXXXX",
"oauth": {
"domain": "XXXXXX",
"scope": [
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
],
"redirectSignIn": "http://localhost:3000/home",
"redirectSignOut": "http://localhost:3000/login/signin",
"responseType": "code"
},
"federationTarget": "COGNITO_USER_POOLS",
"aws_cognito_username_attributes": [],
"aws_cognito_social_providers": [
"GOOGLE"
],
"aws_cognito_signup_attributes": [
"EMAIL"
],
"aws_cognito_mfa_configuration": "OFF",
"aws_cognito_mfa_types": [
"SMS"
],
"aws_cognito_password_protection_settings": {
"passwordPolicyMinLength": 8,
"passwordPolicyCharacters": []
},
"aws_cognito_verification_mechanisms": [
"EMAIL"
]
};
export default awsmobile;
Manual configuration
No response
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: