Skip to content
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

signInWithRedirect has no effect after login #13904

Closed
3 tasks done
MensurRasic opened this issue Oct 10, 2024 · 4 comments
Closed
3 tasks done

signInWithRedirect has no effect after login #13904

MensurRasic opened this issue Oct 10, 2024 · 4 comments
Assignees
Labels
Auth Related to Auth components/category Next.js question General question

Comments

@MensurRasic
Copy link

MensurRasic commented Oct 10, 2024

Before opening, please confirm:

JavaScript Framework

Next.js

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

Amplify Gen 2 (Preview)

Environment information

  Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    npm: 10.1.0 - /usr/local/bin/npm
    Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 129.0.6668.100
    Safari: 17.6
  npmPackages:
    @ampproject/toolbox-optimizer:  undefined ()
    @auth0/auth0-react: ^2.2.3 => 2.2.3 
    @aws-amplify/ui-react-storage: ^3.1.3 => 3.1.3 
    @babel/runtime:  7.22.5 
    @edge-runtime/cookies:  4.0.2 
    @edge-runtime/ponyfill:  2.4.1 
    @edge-runtime/primitives:  4.0.2 
    @types/autosuggest-highlight: ^3.2.3 => 3.2.3 
    @types/google-map-react: ^2.1.10 => 2.1.10 
    @types/google.maps: ^3.55.5 => 3.55.5 
    @types/lodash: ^4.14.202 => 4.14.202 
    @types/mapbox-gl: ^2.7.21 => 2.7.21 
    @types/node: ^20.10.4 => 20.10.4 
    @types/nprogress: ^0.2.3 => 0.2.3 
    @types/react: ^18.2.43 => 18.2.43 
    @types/react-lazy-load-image-component: ^1.6.3 => 1.6.3 
    @types/react-slick: ^0.23.12 => 0.23.12 
    @types/stylis: ^4.2.4 => 4.2.4 
    @typescript-eslint/eslint-plugin: ^6.13.2 => 6.13.2 
    @typescript-eslint/parser: ^6.13.2 => 6.13.2 
    @vercel/nft:  undefined ()
    @vercel/og:  0.5.15 
    aws-amplify: ^6.6.4 => 6.6.4 
    axios: ^1.6.2 => 1.6.8 
    client-only:  0.0.1 
    eslint: ^8.55.0 => 8.55.0 
    framer-motion: ^10.16.16 => 10.16.16 
    net: ^1.0.2 => 1.0.2 
    next: ^14.0.4 => 14.0.4 
    react: ^18.2.0 => 18.2.0 
    react-dom: ^18.2.0 => 18.2.0 
    react-dom-builtin:  undefined ()
    typescript: ^5.3.3 => 5.3.3 
  npmGlobalPackages:
    corepack: 0.20.0
    npm: 10.1.0
    react-devtools: 5.0.0


Describe the bug

When I try to login with a provider such as google, using await signInWithRedirect({ provider: 'Google' });, the nextjs project is stuck at the moment I'm calling await getCurrentUser() right after I get redirected back to the project.

I don't get any error triggered in my try catch nor the project doesn't want to continue the login process.

Here's my Amplify config :
Amplify.configure( { ...awsconfig, oauth: { ...awsconfig.oauth, redirectSignIn: 'http://localhost:8082/dashboard/', redirectSignOut: 'http://localhost:8082/', }, }, { ssr: true } );

I tried the following solutions but none of them works : 12873, 13456, 13472

Expected behavior

The user should be able to complete the login process using the authentication with google sign-in.

Reproduction steps

Setup a nextjs project with aws-amplify: ^6.6.4 and setup a google authentication.
Try to login with the google authentication to the project.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

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

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Oct 10, 2024
@ashika112
Copy link
Member

@MensurRasic Thanks for reaching out. Just wanted to confirm are you following our docs here already for building up your app?

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Oct 10, 2024
@ashika112 ashika112 added Auth Related to Auth components/category Next.js pending-maintainer-response Issue is pending a response from the Amplify team. pending-community-response Issue is pending a response from the author or community. and removed pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Oct 10, 2024
@MensurRasic
Copy link
Author

Yes I did, but the documentation you shared is for Gen 1, I’m on Gen 2.
But I followed Gen 2 documentation as well and it’s still not working.

@github-actions github-actions bot added pending-maintainer-response Issue is pending a response from the Amplify team. and removed pending-community-response Issue is pending a response from the author or community. labels Oct 11, 2024
@cwomack
Copy link
Member

cwomack commented Oct 11, 2024

@MensurRasic, can you confirm that you're importing the import 'aws-amplify/auth/enable-oauth-listener'; on the client side page where your redirect for http://localhost:8082/dashboard/ is? Also, any frontend code you can provide for your authentication flows would be helpful for us to better identify the root cause here.

@cwomack cwomack self-assigned this Oct 11, 2024
@cwomack cwomack added pending-community-response Issue is pending a response from the author or community. question General question and removed pending-maintainer-response Issue is pending a response from the Amplify team. labels Oct 11, 2024
@cwomack
Copy link
Member

cwomack commented Oct 22, 2024

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!

@cwomack cwomack closed this as not planned Won't fix, can't repro, duplicate, stale Oct 22, 2024
@github-actions github-actions bot removed the pending-community-response Issue is pending a response from the author or community. label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category Next.js question General question
Projects
None yet
Development

No branches or pull requests

3 participants