When using Google OAuth, Clerk redirects using the public base URL configured in your Clerk dashboard or environment. If VITE_CLERK_SIGN_IN_REDIRECT_URL
is set to dashboard
, Clerk assumes the full redirect should be /admin/dashboard
. But if you already set your Vite base as /admin
, and then also include /admin
in the Clerk redirect, you’ll end up with /admin/admin/dashboard
— which causes the 404.
Update your .env
with the relative path only — Clerk already knows to prepend the base:
env
VITE_CLERK_SIGN_IN_REDIRECT_URL=/dashboard VITE_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL=/dashboard
Notice the leading /
, but do not include /admin
here.
In your vite.config.ts
, make sure you have:
ts
base: '/admin/'
And in your <BrowserRouter>
:
tsx
<BrowserRouter basename="/admin">
Finally, ensure your Clerk dashboard → Frontend Settings → Sign-In URL is consistent with /admin/sign-in
(or whatever your sign-in route is under the base path).