I was integrating Google OAuth2 into my app and kept getting this error:
"Error 400: redirect_uri_mismatch"
I copied the exact URL from my browser’s search bar and pasted it into both the Authorized redirect URI and the origin field on the Google Cloud Console, Credentials.
Still, I got the error. 😕
Things I Tried:
Checked the Network tab—everything looked fine.
Double-checked the exact redirect URI.
Clicked on error detail to inspect further.
Even though my browser was showing a lock icon and the address bar said https://eco-guard-git-auth-oatulas-projects.vercel.app/auth/google
, the request was actually going over http.
The redirect URI had to be
http://eco-guard-git-auth-oatulas-projects.vercel.app/auth/google
, nothttps
.
Updated both the origin and redirect URI in Google Cloud Console to use http
instead of https
.
That immediately fixed the issue.
If you're running locally and seeing this error, don’t trust the browser's lock icon.
Check whether your server is actually using http
or https
, and make sure the redirect URI matches exactly, including the scheme.