Skip to content

SignUpButton fails to authenticate user if Facebook account was previously linked #4803

Closed

Description

@gabrielmaldi

Preliminary Checks

Reproduction

https://app.replay.io/recording/localhost3000--a6a7a2fd-696d-43ef-b216-ce4c9f3114df?commentId=&focusWindow=eyJiZWdpbiI6eyJwb2ludCI6IjAiLCJ0aW1lIjowfSwiZW5kIjp7InBvaW50IjoiNTg0MTMzMzk2NjUwOTU4NTM2MjQwNzE2NDEzNTYwNDIyNCIsInRpbWUiOjM2OTB9fQ%253D%253D&point=324518553658633099732480646185098&primaryPanel=tour&secondaryPanel=console&time=133&viewMode=non-dev

Publishable key

pk_test_Z2xvd2luZy1iYXQtOTguY2xlcmsuYWNjb3VudHMuZGV2JA

Description

Steps to reproduce:

  1. Use <SignUpButton mode="modal">
  2. Select Facebook:
image
  1. Make sure you had already signed-up using Facebook (so this is conceptually a sign-in really) and select Continue:
image

Expected behavior:

The user is taken back to the site and is now logged-in.

Actual behavior:

The user is taken back to the site but is not logged-in.

The URL is http://localhost:3000/#/sso-callback and these are the requests:

image

Everything works fine if I use <SignInButton> instead, or if I select Already have an account? [Sign in] in the sign-up modal (before selecting Facebook):

image image

In those cases, these are the requests:

image

The one I highlighted seems to be the one making auth work. And the final URL is http://localhost:3000/ (no /#/sso-callback).

I'm not using either of: NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL, NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL, forceRedirectUrl, signInForceRedirectUrl, signUpForceRedirectUrl.

My reasoning is that since if I first select Already have an account? [Sign in], everything works, then this is probably a bug in SignUpButton.

Thanks

Environment

System:
    OS: macOS 15.2
    CPU: (11) arm64 Apple M3 Pro
    Memory: 77.48 MB / 36.00 GB
    Shell: 3.7.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 22.12.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.0 - /usr/local/bin/npm
    bun: 1.1.39 - ~/.bun/bin/bun
    Watchman: 2024.12.02.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 131.1.73.101
    Chrome: 131.0.6778.140
    Chrome Canary: 133.0.6901.0
    Edge: 130.0.2849.56
    Safari: 18.2
    Safari Technology Preview: 18.2
  npmPackages:
    @arcjet/next: ^1.0.0-alpha.34 => 1.0.0-alpha.34
    @babel/core: ^7.26.0 => 7.26.0
    @clerk/nextjs: ^6.9.3 => 6.9.3
    @clerk/themes: ^2.2.2 => 2.2.2
    @mailchimp/mailchimp_marketing: ^3.0.80 => 3.0.80
    @mantine/carousel: ^7.15.1 => 7.15.1
    @mantine/colors-generator: ^7.15.1 => 7.15.1
    @mantine/core: ^7.15.1 => 7.15.1
    @mantine/dates: ^7.15.1 => 7.15.1
    @mantine/form: ^7.15.1 => 7.15.1
    @mantine/hooks: ^7.15.1 => 7.15.1
    @mantine/modals: ^7.15.1 => 7.15.1
    @mantine/notifications: ^7.15.1 => 7.15.1
    @mantine/nprogress: ^7.15.1 => 7.15.1
    @next/bundle-analyzer: 15.1.0 => 15.1.0
    @portabletext/react: ^3.2.0 => 3.2.0
    @portabletext/to-html: ^2.0.13 => 2.0.13
    @portabletext/types: ^2.0.13 => 2.0.13
    @react-email/components: ^0.0.31 => 0.0.31
    @sanity/image-url: ^1.1.0 => 1.1.0
    @sanity/webhook: ^4.0.4 => 4.0.4
    @sentry/nextjs: ^8.46.0 => 8.46.0
    @t3-oss/env-nextjs: ^0.11.1 => 0.11.1
    @tabler/icons-react: ^3.26.0 => 3.26.0
    @talkjs/react: ^0.1.11 => 0.1.11
    @total-typescript/ts-reset: ^0.6.1 => 0.6.1
    @types/async: ^3.2.24 => 3.2.24
    @types/bun: ^1.1.14 => 1.1.14
    @types/jsdom: ^21.1.7 => 21.1.7
    @types/jsonwebtoken: ^9.0.7 => 9.0.7
    @types/lodash: ^4.17.13 => 4.17.13
    @types/mailchimp__mailchimp_marketing: ^3.0.20 => 3.0.20
    @types/node: ^22.10.2 => 22.10.2
    @types/superagent: ^8.1.9 => 8.1.9
    @vercel/analytics: ^1.4.1 => 1.4.1
    @vercel/kv: ^3.0.0 => 3.0.0
    @vercel/postgres: ^0.10.0 => 0.10.0
    add-to-calendar-button: ^2.7.3 => 2.7.3
    async: ^3.2.6 => 3.2.6
    babel-loader: ^9.2.1 => 9.2.1
    babel-plugin-react-compiler: ^19.0.0-beta-201e55d-20241215 => 19.0.0-beta-201e55d-20241215
    change-case: ^5.4.4 => 5.4.4
    chroma-js: ^3.1.2 => 3.1.2
    clsx: ^2.1.1 => 2.1.1
    conditional-wrap: ^1.0.2 => 1.0.2
    dayjs: ^1.11.13 => 1.11.13
    drizzle-kit: ^0.30.1 => 0.30.1
    drizzle-orm: ^0.38.2 => 0.38.2
    embla-carousel-autoplay: 7.1.0 => 7.1.0
    embla-carousel-react: 7.1.0 => 7.1.0
    eslint-plugin-deprecated-props: ^0.1.3 => 0.1.3
    eslint-plugin-deprecation: ^3.0.0 => 3.0.0
    eslint-plugin-react-compiler: ^19.0.0-beta-201e55d-20241215 => 19.0.0-beta-201e55d-20241215
    jiti: ^2.4.1 => 2.4.1
    jsdom: ^25.0.1 => 25.0.1
    jsonwebtoken: ^9.0.2 => 9.0.2
    lodash: ^4.17.21 => 4.17.21
    mantine-datatable: 7.14.5 => 7.14.5
    next: ^15.1.0 => 15.1.0
    next-sanity: ^9.8.27 => 9.8.27
    next-view-transitions: ^0.3.4 => 0.3.4
    pg: ^8.13.1 => 8.13.1
    postcss: ^8.4.49 => 8.4.49
    postcss-preset-mantine: ^1.17.0 => 1.17.0
    postcss-simple-vars: ^7.0.1 => 7.0.1
    prettier: ^3.4.2 => 3.4.2
    react: ^19.0.0 => 19.0.0
    react-canvas-confetti: ^2.0.7 => 2.0.7
    react-dom: ^19.0.0 => 19.0.0
    react-email: ^3.0.4 => 3.0.4
    react-geolocated: ^4.2.0 => 4.3.0
    react-google-autocomplete: ^2.7.3 => 2.7.3
    react-google-places-autocomplete: ^4.1.0 => 4.1.0
    remix-params-helper: ^0.5.1 => 0.5.1
    resend: ^4.0.1 => 4.0.1
    server-only: ^0.0.1 => 0.0.1
    sqids: ^0.3.0 => 0.3.0
    stripe: ^17.4.0 => 17.4.0
    superjson: ^2.2.2 => 2.2.2
    svix: ^1.44.0 => 1.44.0
    swr: ^2.2.5 => 2.2.5
    talkjs: ^0.31.0 => 0.31.0
    type-fest: ^4.30.2 => 4.30.2
    types-react:  19.0.0-rc.1
    types-react-dom:  19.0.0-rc.1
    typescript: ^5.7.2 => 5.7.2
    typescript-plugin-css-modules: ^5.1.0 => 5.1.0
    vercel: ^39.2.2 => 39.2.2
    zod: ^3.24.1 => 3.24.1

Activity

  1. added
    bugSomething isn't working
    and removed
    needs-triageA ticket that needs to be triaged by a team member
    on Dec 19, 2024
  2. clerk-cookie commented on Jan 19, 2025

    @clerk-cookie
    Collaborator

    Hello 👋

    We currently close issues after 40 days of inactivity. It's been 30 days since the last update here. If we missed this issue, please reply here. Otherwise, we'll close this issue in 10 days.

    As a friendly reminder: The best way to see an issue fixed is to open a pull request. If you're not sure how to do that, please check out our contributing guide.

    Thanks for being a part of the Clerk community! 🙏

  3. gabrielmaldi commented on Jan 19, 2025

    @gabrielmaldi
    Author

    This is still an issue.

  4. alexcarpenter commented on Jan 29, 2025

    @alexcarpenter
    Member

    Hey @gabrielmaldi this should have been resolved in #4961

  5. gabrielmaldi commented on Jan 29, 2025

    @gabrielmaldi
    Author

    Hi, @alexcarpenter. Just tested this and it didn't work for me. From Facebook I get redirected to http://localhost:3000/sign-up#/sso-callback?sign_up_force_redirect_url=http%3A%2F%2Flocalhost%3A3000%2F&sign_in_force_redirect_url=http%3A%2F%2Flocalhost%3A3000%2F without having an active session. Thank you.

  6. alexcarpenter commented on Jan 29, 2025

    @alexcarpenter
    Member

    @gabrielmaldi can you provide a minimal repo of your setup that includes the issue for us to help debug.

  7. dstaley commented on Jan 29, 2025

    @dstaley
    Member

    @gabrielmaldi Also would you mind confirming if this is only with Facebook login? Does the issue happen if you use Google or Microsoft?

  8. gabrielmaldi commented on Jan 29, 2025

    @gabrielmaldi
    Author

    @dstaley, yes, just tested with Google and got the same result: I get redirected to http://localhost:3000/sign-up#/sso-callback (a route/page I don't have, so 404).

    If I use <SignInButton> (instead of <SignUpButton>), and select either Facebook or Google, everything works fine.

    @alexcarpenter, I won't have enough time to produce a minimal repo for a while, sorry.

    Thanks!

  9. alexcarpenter commented on Feb 3, 2025

    @alexcarpenter
    Member

    @gabrielmaldi ah ok, I am assuming you don't have a mounted <SignUp /> component on your website somewhere?

  10. gabrielmaldi commented on Feb 3, 2025

    @gabrielmaldi
    Author

    @alexcarpenter, yes, we have both a login and a signup button in the header:

    Image

    You can repro this issue in: https://beta.ad-in.me
    First sign-up using Facebook (or Google), then sign-out, hit sign up and select Facebook, use the same Facebook account, error. Using sign-in does work.

    Thanks!

  11. alexcarpenter commented on Feb 3, 2025

    @alexcarpenter
    Member

    @gabrielmaldi thanks for the link. The <SignUpButton mode="modal" /> modal mode usage requires you to still mount a <SignUp /> component somewhere on your site to handle the sso-callback redirect.

  12. gabrielmaldi commented on Feb 3, 2025

    @gabrielmaldi
    Author

    @alexcarpenter, adding a /sign-up route with a <SignUp /> component fixed it, thanks! Could it be that this was a recent change? Previously, I had everything working without this. Anyway, closing the issue, thanks again.

  13. github-actions commented on Feb 4, 2026

    @github-actions
    Contributor

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  14. locked as resolved and limited conversation to collaborators on Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions