Skip to content

redirect_url is appended after signing out #5590

Description

@xeroxoid

Preliminary Checks

Reproduction

https://github.com/clerk/clerk-react-quickstart

Publishable key

pk_test_cHJvdmVuLWdsaWRlci04Mi5jbGVyay5hY2NvdW50cy5kZXYk

Description

Steps to reproduce:

Using @clerk/react version ^5.26.2 on a SPA React app with React Router 6.26.0

  1. While signed-in, navigate to any page inside the app (i.e. /the/url/before/signing/out)
  2. Hard refresh
  3. Sign out (tried with signOut(), signOut({ redirectUrl: '' }), signOut({ redirectUrl: '/sign-in' }) and signOut({ redirectUrl: '/' })
  4. You land on the sign-in page but have query param redirect_url=/the/url/before/signing/out (as well as sign_in_fallback_redirect_url, sign_up_force_redirect_url, etc.)

Weird thing is that this does not happen if I do not refresh.

Expected behavior:

Redirect to sign in page without any query params.

When signing in I do not expect to land on the page I was when I signed-out. Another user might sign in and land on a page which might give them an error/404/forbidden.

On the other hand I understand that as per documentation and would expect if I visit /users/123/details while signed out, to get the redirect url and be redirected to that after signing in.

Actual behavior:

Redirected to sign-in with query params set (esp. redirect_url=/the/url/before/signing/out)

This is also reproducible with https://github.com/clerk/clerk-react-quickstart

Environment

System:
    OS: macOS 15.4
    CPU: (12) arm64 Apple M2 Max
    Memory: 85.14 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.1 - ~/.local/state/fnm_multishells/12907_1744287998041/bin/node
    npm: 11.1.0 - ~/.local/state/fnm_multishells/12907_1744287998041/bin/npm
    pnpm: 10.6.5 - ~/Library/pnpm/pnpm
    Watchman: 2025.03.10.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 135.0.7049.84
    Safari: 18.4
  npmPackages:
    @0no-co/graphqlsp: ^1.12.6 => 1.12.16
    @apollo/client: ^3.11.2 => 3.11.8
    @apollo/sandbox: ^2.6.0 => 2.7.0
    @clerk/clerk-react: ^5.26.2 => 5.26.2
    @clerk/themes: ^2.1.15 => 2.1.39
    @daily-co/daily-js: ^0.72.1 => 0.72.1
    @daily-co/daily-react: ^0.21.2 => 0.21.2
    @datadog/browser-logs: ^5.23.3 => 5.29.0
    @dnd-kit/core: ^6.1.0 => 6.1.0
    @dnd-kit/modifiers: ^7.0.0 => 7.0.0
    @dnd-kit/sortable: ^8.0.0 => 8.0.0
    @dnd-kit/utilities: ^3.2.2 => 3.2.2
    @fortawesome/fontawesome-svg-core: ^6.6.0 => 6.6.0
    @fortawesome/free-brands-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/free-regular-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/free-solid-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/pro-duotone-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/pro-light-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/pro-regular-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/pro-solid-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/pro-thin-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/react-fontawesome: ^0.2.2 => 0.2.2
    @fortawesome/sharp-light-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/sharp-regular-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/sharp-solid-svg-icons: ^6.6.0 => 6.6.0
    @fortawesome/sharp-thin-svg-icons: ^6.6.0 => 6.6.0
    @gql.tada/cli-utils: ^1.6.3 => 1.6.3
    @hookform/resolvers: ^3.9.0 => 3.9.0
    @ianvs/prettier-plugin-sort-imports: ^4.3.1 => 4.3.1
    @tailwindcss/container-queries: ^0.1.1 => 0.1.1
    @tanstack/react-table: ^8.19.3 => 8.20.5
    @testing-library/jest-dom: ^6.6.3 => 6.6.3
    @testing-library/react: ^16.2.0 => 16.2.0
    @testing-library/user-event: ^14.6.1 => 14.6.1
    @total-typescript/ts-reset: ^0.5.1 => 0.5.1
    @types/luxon: ^3.4.2 => 3.4.2
    @types/node: ^20.17.0 => 20.17.0
    @types/react: ^18.3.3 => 18.3.12
    @types/react-copy-to-clipboard: ^5.0.7 => 5.0.7
    @types/react-dom: ^18.3.0 => 18.3.1
    @types/react-syntax-highlighter: ^15.5.13 => 15.5.13
    @types/validator: ^13.12.2 => 13.12.2
    @typescript-eslint/eslint-plugin: ^8.21.0 => 8.21.0
    @typescript-eslint/parser: ^8.21.0 => 8.21.0
    @vitejs/plugin-legacy: ^5.4.3 => 5.4.3
    @vitejs/plugin-react-swc: ^3.7.0 => 3.7.1
    @wiserwork/tailwind-config: workspace:* => 0.0.0
    @wiserwork/ui: workspace:* => 0.0.1
    autoprefixer: ^10.4.19 => 10.4.20
    axios: ^1.7.4 => 1.7.7
    class-variance-authority: ^0.7.0 => 0.7.0
    clsx: ^2.1.1 => 2.1.1
    cmdk: ^1.0.0 => 1.0.0
    crisp-sdk-web: ^1.0.25 => 1.0.25
    date-fns: ^3.6.0 => 3.6.0
    dedent: ^1.5.3 => 1.5.3
    dotenv: ^16.4.5 => 16.4.5
    eslint: ^8.57.0 => 8.57.1
    framer-motion: ^11.3.21 => 11.11.9
    gql.tada: ^1.8.5 => 1.8.10
    graphql: ^16.9.0 => 16.9.0
    graphql-ws: ^5.16.0 => 5.16.0
    jotai: ^2.10.0 => 2.10.1
    jsdom: ^26.0.0 => 26.0.0
    localforage: ^1.10.0 => 1.10.0
    lucide-react: ^0.428.0 => 0.428.0
    luxon: ^3.5.0 => 3.5.0
    match-sorter: ^6.3.4 => 6.4.0
    next-themes: ^0.3.0 => 0.3.0
    postcss: ^8.4.40 => 8.4.47
    posthog-js: ^1.219.1 => 1.219.1
    prettier: ^3.3.3 => 3.3.3
    prettier-plugin-tailwindcss: ^0.6.8 => 0.6.8
    react: ^18.2.0 => 18.3.1
    react-cookie-consent: ^9.0.0 => 9.0.0
    react-copy-to-clipboard: ^5.1.0 => 5.1.0
    react-day-picker: ^8.10.1 => 8.10.1
    react-dom: ^18.2.0 => 18.3.1
    react-helmet-async: ^2.0.5 => 2.0.5
    react-hook-form: ^7.52.1 => 7.53.1
    react-markdown: ^9.0.1 => 9.0.1
    react-resizable-panels: ^2.0.22 => 2.1.5
    react-router-dom: ^6.26.0 => 6.27.0
    react-spinners: ^0.14.1 => 0.14.1
    react-textarea-autosize: ^8.5.3 => 8.5.4
    react-timezone-select: ^3.2.8 => 3.2.8
    recoil: ^0.7.7 => 0.7.7
    remark-gfm: ^4.0.0 => 4.0.0
    remark-math: ^6.0.0 => 6.0.0
    remark-supersub: ^1.0.0 => 1.0.0
    rimraf: ^6.0.1 => 6.0.1
    socket.io-client: ^4.7.5 => 4.8.0
    sonner: ^1.5.0 => 1.5.0
    sort-by: ^1.2.0 => 1.2.0
    tailwind-merge: ^2.4.0 => 2.5.4
    tailwindcss: ^3.4.7 => 3.4.14
    tsx: ^4.16.5 => 4.19.1
    type-fest: ^4.23.0 => 4.26.1
    typescript: ^5.7.2 => 5.7.3
    unplugin-fonts: ^1.1.1 => 1.1.1
    use-debounce: ^10.0.2 => 10.0.4
    validator: ^13.12.0 => 13.12.0
    vite: ^5.3.5 => 5.4.10
    vite-tsconfig-paths: ^5.0.1 => 5.0.1
    vitest: ^3.0.3 => 3.0.3
    zod: ^3.23.8 => 3.23.8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions