Google oauth redirecting to /api/auth
Hi, I'm setting up Google oauth in my app but when I login through google I get redirected to /api/auth (which 404s) and I can't figure out why its redirecting here.
These are my network requests when logging in:
My setup is:
And for my login onClick I'm doing
Solution:Jump to solution
Figured out auth flow was working but still dont know why it was redirecting there after, updated my callback url to an actual page and seems to work fine 🤷♀️
9 Replies
Did you configure the redirect URL in your google console?

Ye i have it under here

Solution
Figured out auth flow was working but still dont know why it was redirecting there after, updated my callback url to an actual page and seems to work fine 🤷♀️
I was actually just about to say because I looked at my implementation
Glad you got that sorted
Hey, I’m facing the same issue. It redirected me to the callback page with the authorization code. Am I supposed to call the access token from Google using the authorization code, or does BetterAuth handle that for me—like using the refresh token to get a new access token when it expires?
no better auth handles receiving the authorization code , exchanging the code for access tokens
and also managing refresh tokens.
hey @KiNFiSH do you know if there is a way to exchange the code manually?
For getting oauth token ?
Like supabase
supabase.auth.exchangeCodeForSession('oauth code')