For builders shipping this week
Bolt.new Google login not working after deploy on Netlify
FirstUser opens your live URL, signs up and logs in with an email and a password, and tries checkout. A failed step comes back with a screenshot and a fix prompt you can paste into Bolt. It does not complete a Google account consent screen. Run a free signup test.
Sign in with Google can look fine while you are in Bolt, then fail after you publish to Netlify or attach a custom domain. Bolt's Google SSO article says Google's OAuth flow blocks iframes, so the preview window is the wrong place to call it working. The published address is a new origin. Supabase and Google each keep their own allow list, and a Bolt app on Netlify is a static build that only serves files that exist.
The screen you get tells you which list failed. Work from that, then test the live URL in a private window. Email and password signup on the same deploy is a separate checklist: Bolt signup works in the preview but fails on Netlify. The same Google allow lists on a Lovable app are in Lovable Google login not working.
Which failure are you looking at?
- Google's own error page, Error 400: redirect_uri_mismatch. Google's OAuth docs say the
redirect_uriin the request does not match an Authorized redirect URI. Copy the value from that page. For Supabase it is the project callback, not your Netlify URL. Check 2. - Google's page says origin_mismatch. Google Cloud help says a request from an unregistered JavaScript origin returns that error. The live scheme and host are missing from Authorized JavaScript origins. www and the apex are different origins. Check 2 and check 4.
- The browser comes back to your login page, or opens localhost or the Bolt preview. Google already accepted the request. Supabase then sends the browser to
redirectToor, when that URL is not allowed, to the Site URL. Bolt's authentication article says the default Site URL islocalhost:3000. Anerroranderror_descriptionin the query or the hash is that redirect failing. Supabase's redirect guide reads those from the hash. If the address bar is the live site and there is no error, the guard redirected before the session loaded. Check 1, check 3, and check 6. - Netlify's "Page not found" on the callback path. Google and Supabase finished. The path in the address bar is not a file in the publish folder. Check 5.
1. Put the live domain on the Site URL and on Redirect URLs
Supabase's redirect guide says the Site URL is the default redirect when the code does not pass redirectTo. Change it from http://localhost:3000 to the address visitors use, for example https://yourapp.com or your *.netlify.app URL. The same guide says the URL you pass as redirectTo has to match the Redirect URLs allow list.
On a Bolt Cloud database, those fields are the database icon → Authentication. Bolt calls the allow list the URI allow list and says Supabase only redirects to URLs on that list, then falls back to the Site URL. Bolt says it usually updates both when you publish, and that you still edit them yourself when the app has more than one domain. A project can be left on localhost:3000. If the app uses your own Supabase project, set the same two fields under Authentication → URL Configuration.
Add every origin you sign in from: the Netlify URL, the custom domain, and www if people can open it. For Netlify preview deploys, Supabase's example extra allow-list entry is https://**--my_org.netlify.app/**, with the Site URL set to the official site. A single * matches within one path segment and does not cross / or .. ** crosses both. Supabase recommends the exact production path, and treats ** as the preview and local pattern. The same Site URL problem sends password-reset mail to localhost: password reset or magic link opens localhost.
2. Google's redirect URI is the Supabase callback. The live site is a JavaScript origin
Supabase's Google guide says to create a Web application client, add the app URL under Authorized JavaScript origins, and add the Supabase project's callback under Authorized redirect URIs. Copy that callback from the Google provider page in the Supabase dashboard. Bolt shows the same pair under Authentication → Continue with Google. On a hosted project the callback looks like:
https://<project-ref>.supabase.co/auth/v1/callback
Bolt's Google SSO article uses an example on supabase.com (https://loremipsumexample.supabase.com/auth/v1/callback). Paste the string the dashboard shows. Google compares it character for character: the docs say the http or https scheme, the case, and a trailing slash all have to match. Local Supabase uses http://127.0.0.1:54321/auth/v1/callback. Putting only the Netlify URL in Authorized redirect URIs leaves the callback Google was asked to use unregistered, which is redirect_uri_mismatch.
Authorized JavaScript origins are the scheme and host, with no path. Supabase's example: an app at https://example.com/app is entered as https://example.com. Add the Netlify host and the custom domain. Google's client-ID guide says to add http://localhost and http://localhost:<port> while you develop, and Supabase says to remove the localhost origin when the app is in production. An origin that is not on the list returns origin_mismatch. Google Cloud help says changes to these settings can take 5 minutes to a few hours.
Bolt also says a new OAuth app stays in Testing, which limits sign-in to up to 100 users, until you publish it under Google Auth Platform → Audience. Accounts you did not add as test users are the ones that stop.
3. redirectTo in signInWithOAuth still points at the preview or localhost
Supabase's signInWithOAuth reference takes the return address as options.redirectTo. The Google guide shows it as the callback route on your app, and says that URL has to be on the redirect allow list. If the code omits redirectTo, the Site URL from check 1 is where the browser goes.
await supabase.auth.signInWithOAuth({
provider: 'google',
options: {
redirectTo: 'https://yourapp.com/auth/callback',
},
})Search the project for redirectTo set to localhost, a bolt.host preview, or another address you only used while building. That value wins over the Site URL, and it still has to be on the allow list. Bolt says a URL that is not on the list falls back to the Site URL, which is how a live click ends on localhost. Point redirectTo at the origin the visitor actually has open, including the callback path if the app has one, and add that exact URL under Redirect URLs.
Supabase's Google guide says an implicit flow returns the session to the app after Google's consent screen. A PKCE flow, which the same guide uses for server-side auth, needs the callback route to exchange the code. signInWithOAuth stores the code verifier in a cookie. If that cookie never reaches the browser, the callback cannot create a session. A Bolt app published as a static Netlify site is usually the browser client. The path you send people to still has to load, which is check 5.
4. www and the apex domain are different origins
Google Cloud help says a JavaScript origin cannot contain a path, a query, or a wildcard. https://www.yourapp.com and https://yourapp.com are two origins. The same split applies to the Netlify hostname and the custom domain. Add each one people can open. Bolt's Google SSO article says you may need more than one origin and more than one redirect URI when the project has more than one domain.
Supabase's wildcard table treats . as a separator, so * in a host does not jump from the apex to www. Add both hosts to Redirect URLs, or redirect one host to the other at the DNS or Netlify layer and use only that host in redirectTo. A session stored on one host is not visible on the other. The longer version of that, including localStorage being specific to the protocol, is in "Auth session missing!" or a login loop after deploy.
5. The callback path 404s because Netlify has no SPA rewrite
After Google returns to the Supabase callback, Supabase redirects to your redirectTo, often /auth/callback or the site root with a hash. A Bolt React app is one index.html. Netlify looks for a file at that path. There isn't one, so the visitor sees Netlify's "Page not found" and the app never reads the session.
Netlify's rewrite docs say a 200 status keeps the address bar URL and serves another file. For a single-page app they show this rule, usually last:
/* /index.html 200
Put it in public/_redirects. Netlify's Bolt deploy article says Vite copies public/ into dist. A _redirects file left at the project root is not in that folder. Bolt's publishing troubleshooting uses the same line, and says that if the project has a netlify.toml, add the rule there instead:
[[redirects]] from = "/*" to = "/index.html" status = 200
Keep the status at 200. A redirect status would change the address away from the callback. Publish again, then open the callback path directly. The home page loading does not prove this rule is in the deploy.
6. The auth guard redirects before the session has loaded
This one looks like a loop on the live domain: Google finishes, the app loads, and the login page is back, with no redirect_uri_mismatch and no Netlify 404. The browser client restores the saved session as the page starts. A guard that reads "no user" on the first render sends the visitor to /login before that restore finishes.
onAuthStateChange sends INITIAL_SESSION first, with the stored session or null. getSession() returns the session from the client's storage and can be null when nobody is signed in. Wait until INITIAL_SESSION has fired, or until getSession() has resolved, and only then redirect. Supabase says not to trust getSession() when that storage is request cookies, because it does not revalidate them, and to use getUser() there instead. A static Bolt app on Netlify usually makes this decision in the browser. The full pattern, and the server-cookie case, is in "Auth session missing!" or a login loop after deploy.
Paste-ready prompt for Bolt
Google sign-in fails on my deployed site [paste the live URL]. The symptom is [redirect_uri_mismatch, a return to the login page, or Page not found on the callback]. Use window.location.origin for redirectTo in signInWithOAuth, not localhost or the preview. List the Site URL and Redirect URLs to add in Supabase, including www and the apex if both are used. The Google Authorized redirect URI must be the Supabase callback https://<project-ref>.supabase.co/auth/v1/callback, and the live origins belong under Authorized JavaScript origins. Add public/_redirects with /* /index.html 200 so the callback path loads. Wait for INITIAL_SESSION before any auth guard redirects to login.
Test the live URL, signed out
Open the Netlify URL or the custom domain in a private window. Click Sign in with Google and watch the address bar: a Google error page, a hop to localhost or the preview, a Netlify 404, or a return to your login page. Then sign up with an email and password you have never used, log out, log in, and refresh a deep page. Your normal browser can still be holding the preview session.
FirstUser opens that live URL as a new visitor, looks for an email field and a password, signs up, logs in, and tries checkout. Checkout passes when a price is visible. It does not enter a card, and it does not complete a Google consent screen. If the only button is Sign in with Google, the email-form step fails and the report says so, with a screenshot and a fix prompt.
FAQ
Why does Sign in with Google work in Bolt and fail on the Netlify URL?
Bolt's Google SSO article says Google's OAuth flow blocks iframes, so the preview window is the wrong place to judge it. The published Netlify address, and a custom domain, are new origins. Supabase's Site URL and Redirect URLs have to name them, and Google's Authorized JavaScript origins have to name them too. The Authorized redirect URI stays the Supabase callback.
Google shows Error 400: redirect_uri_mismatch. Which address do I add?
Copy the redirect_uri on Google's error page into the OAuth client's Authorized redirect URIs. For Supabase that value is the project callback, shown on the Google provider page. On a hosted project it looks like https://<project-ref>.supabase.co/auth/v1/callback. Google's OAuth docs say the scheme, case, and trailing slash have to match. Your Netlify URL belongs under Authorized JavaScript origins, which cannot include a path.
I land back on the login page and Google never showed an error. What failed?
Read the address bar. Localhost or a Bolt preview means redirectTo or the Site URL still points there, or the live URL is missing from Redirect URLs and Supabase fell back to the Site URL. A hash or query with error and error_description is Supabase sending the failure back to your redirect URL. The live domain, with no error and an immediate return to login, is the guard running before onAuthStateChange reports INITIAL_SESSION. A Netlify Page not found is the SPA rewrite, covered in the callback check.
www works and the bare domain loops. Are those the same site?
They are different hosts. Google's JavaScript origins are scheme plus host, so www and the apex are different origins. Supabase's * wildcard does not cross a dot, so an allow-list entry for one host does not cover the other. The session is stored for one origin. Add both, or redirect one host to the other, and use that host in redirectTo.
Can FirstUser complete the Google consent screen?
No. FirstUser opens the live URL, signs up and logs in with an email and a password, and tries checkout. It does not complete a Google account consent screen. The sign-up step looks for a sign-up link and an email field. If the only control is Sign in with Google, that step fails with "No sign-up form was found." The login step looks for an email and password login. If it cannot find one, it fails with "No login form was found." Checkout passes when a price is visible, and the saved message is "Opened the pricing or checkout page and found a price." It does not enter a card. A failed step includes a screenshot and a fix prompt you can paste into Bolt. Run a free signup test.
Sources
- Supabase docs: Redirect URLs
- Supabase docs: Sign in with Google
- Supabase JavaScript reference: signInWithOAuth
- Supabase JavaScript reference: onAuthStateChange
- Supabase JavaScript reference: getSession
- Google docs: OAuth 2.0 for web server applications
- Google Cloud help: Manage OAuth clients
- Google docs: Authorized JavaScript origins and redirect URIs
- Netlify docs: Rewrites and proxies
- Bolt docs: Google SSO
- Bolt docs: Database authentication settings
- Bolt docs: Publishing issues
- Bolt docs: Netlify for hosting
- Netlify: Deploy your Bolt app