Google login does not work on my Lovable app. How do I fix it?
Short answer: In almost every case the cause is a mismatch between three addresses: the Site URL and redirect list in your login service, the redirect address registered in Google Cloud, and the address your app actually runs on. Lovable, an AI tool that builds web apps from prompts, handles sign-in with Supabase (a database and login service), either through its built-in backend, which is built on Supabase's open-source foundation, or through a Supabase project you connect yourself. Set the Supabase Site URL to your live address, add that address to the redirect list, make sure Google's authorized redirect URI is the callback address Supabase gives you, then test in a private browser window and on a phone.
People click Sign in with Google on your Lovable app and get an error, a blank page or the wrong address, and you need the shortest path to a fix.
I'm Ranjit, and I run Blur Studio: 15+ years building software, 120 apps taken live, and clients who have gone on to raise $10M+. I build AI systems and processes that help businesses do a lot more with a lot less time. I also work differently from most of what else is out there, more on that further down this page. Say hello.
Start here: which backend does your app use?
Lovable has two ways to run the login. The setup you follow depends on which one your app uses, so check this first.
- The built-in backend. Lovable's documentation says this is on by default, and that Google sign-in is configured through Lovable, in More, then Users, then Settings, then Google. It offers a managed option (Lovable looks after the Google credentials) or your own Google credentials.
- Your own Supabase project. Here, Lovable's documentation says authentication settings live in your Supabase project. You turn on Google in the Supabase dashboard under Authentication and supply the Google details yourself.
If you are not sure, open your project. If the Users view is inside Lovable, you are probably on the built-in backend. If you log in to a separate Supabase dashboard to see users, you are on your own project. The two sections below cover each. Most of the symptoms in the table are the same either way.
Symptoms and the usual cause
| What you see | Most likely cause |
|---|---|
| After Google sign-in, the browser lands on a localhost address | The Site URL in Supabase is still the default (http://localhost:3000) |
| Google shows a redirect_uri_mismatch error | The redirect address in Google Cloud does not exactly match what the app sends |
| Works on the Lovable preview address, fails on your own domain | The new domain was never added to the redirect list or to Google Cloud |
| Works for you, fails for everyone else | The Google app is still in Testing mode, so only listed test users can sign in |
| Password reset or confirmation email links point to the wrong place | The same Site URL problem |
Fix 1: Site URL and redirect URLs (own Supabase project)
Supabase's documentation says the Site URL is the default redirect address when none is specified in the code. It says to change it from http://localhost:3000 to your production address, and that it is critical for email confirmations and password resets.
- Open your Supabase dashboard and go to Authentication, then URL Configuration.
- Set Site URL to your live address, for example https://yourbusiness.com. Use the exact address people use, including https and either with or without www, whichever you chose.
- Under Redirect URLs, add every address your app can send people back to. That means your live domain, and your Lovable preview address if you still test on it.
- Prefer exact addresses. Supabase supports wildcards, but its documentation says to set the exact redirect path for your site in production, and keep broad patterns for local development and preview addresses.
- Save, then try again in a private window.
The documentation also notes that the redirect address your app asks for must match the allow list, so if you changed your domain, the list needs the new one. If your app moved to its own domain recently, my guide to putting an AI-built app online under your own domain covers the whole move.
Fix 2: The Google Cloud settings (own Supabase project)
Google Cloud is where you register your app with Google so it is allowed to offer Sign in with Google. Supabase's Google guide describes this setup:
- In the Google Auth Platform console, create an OAuth client ID (the credential that identifies your app to Google) and choose the type Web application.
- Under Authorized JavaScript origins, add your app's address. Supabase's guide says that if the app is at https://example.com/app, you add https://example.com. Add localhost only while developing, and remove it for production.
- Under Authorized redirect URIs, add your Supabase project's callback address. Do not type this from memory: copy it from the Google provider page in your Supabase dashboard.
- Save the Client ID and Client secret, and paste them into the Google provider page in Supabase, then save there.
Google's help documentation says the redirect address must match exactly, and that the scheme (http or https), the letter case and a trailing slash all matter. If you see redirect_uri_mismatch, compare the address in the error message with the one in your Google client character by character.
Also check the scopes (the pieces of information the app asks for). Supabase's guide says you need openid (added by hand), userinfo.email and userinfo.profile. It warns that adding more sensitive scopes can trigger Google's verification, which can take a long time.
Fix 3: If you use the built-in backend
With the managed option, Lovable's documentation says Lovable handles the credentials and redirect handling, and you do not need to configure Google Cloud. Try these in order:
- Confirm Google sign-in is switched on in More, then Users, then Settings, then Google.
- Ask Lovable to add the sign-in button again, with the message "Add Google login to my app so that users can sign in with their Google account."
- If you use your own Google credentials, note this carefully. Lovable's documentation says that when you connect a custom domain later, Lovable adds the new redirect URL to the list but does not select it. Until you add it as an Authorized redirect URI in Google Cloud, select it in Lovable and click Save, Google sign-in fails on the new domain with a redirect URI mismatch error.
- Use a Web application client type. The documentation says mobile or desktop client types do not work with Lovable's redirect flow.
This custom-domain gap fits the classic story of "it worked on the preview address and broke on my own domain."
It works for you, but not for your users
Google's help page on app audience says that a project with a publishing status of Testing is limited to up to 100 test users listed on the consent screen. Lovable's troubleshooting notes say the same thing in practice: add your account as a test user if the app is not published.
So when you are ready for real users, open the consent screen settings in Google Cloud and publish the app (set it to In production). If you request more than the basic sign-in scopes, Google may require verification before the app is fully open, so keep the scopes to the basics.
A test checklist, including a phone
- Open your live address in a private or incognito window, so old sessions do not hide the problem.
- Click Sign in with Google. You should reach Google's screen, approve, and land back on your app signed in.
- Check the address bar after you return. If it says localhost, go back to Fix 1.
- Sign out and sign in again, to test a returning user.
- Repeat on a real phone, on both your home Wi-Fi and mobile data, with the phone's own browser.
- Test with a Google account that is not yours and not listed as a test user.
- Test password reset and the confirmation email, if your app has email sign-up. Open the link from your phone.
While you test, Lovable's Supabase documentation suggests turning off email confirmation in Supabase so test accounts can sign in at once, and turning it back on before you launch to real users. Do not forget that step.
When the login problem signals something bigger
A login that breaks on a new domain is a configuration problem, and a fair fix takes minutes once you know where to look. But if the login is wrong in other ways, such as users seeing each other's data, I would stop and look wider. Login is only the front door. What the app lets a signed-in user read and change is controlled by database rules, and an AI-built app needs those rules checked. See the row level security fix for Lovable apps, the AI-built app security checklist, and why AI-built apps break.
If you keep patching and new login errors keep appearing, a person who reads the code can usually find the single cause. Hiring a Lovable developer covers what to ask for, and what production ready means for a vibe-coded app shows what else belongs on the list before launch.
How I'd approach this
I would not ask the AI to "fix the login" over and over. Each fix guesses at a cause, and the cause is usually not in the code at all, it is in three settings pages. So I would write down three addresses on a piece of paper: the address your customers use, the address in the Supabase (or Lovable) settings, and the address in Google Cloud. If they do not agree, fix that first.
Then I would change one thing at a time and test after each, in a private window. When it works, I would test on a phone and with a stranger's Google account, since that is how your customers will meet it. And before launch, I would make sure the Google app is published, the localhost entries are gone, and email confirmation is back on. If something still fails after that, this is a small, bounded job for a developer, not a rebuild.
Questions people ask
Why does Lovable Google login send me to localhost?
Supabase's documentation says the Site URL is the default redirect address, and its default is http://localhost:3000. Change it to your live address in Authentication, then URL Configuration, and add that address to the redirect list. The Site URL also affects confirmation emails and password resets.
What does redirect_uri_mismatch mean?
It means the address your app sent to Google is not on the list of authorized redirect URIs for your Google client. Google says the scheme, letter case and trailing slash must all match exactly. Compare the address in the error with your Google client settings.
Google login worked on the preview but not on my domain. Why?
The new domain was not added everywhere. With your own Google credentials, Lovable's documentation says it adds the domain's redirect URL to the list but does not select it, and sign-in fails until you add it in Google Cloud, select it in Lovable and save. On your own Supabase project, add the domain to the redirect list too. See putting your app online under your own domain.
Google login works for me but not for my customers. What is wrong?
Your Google app is probably still in Testing mode. Google says Testing projects are limited to up to 100 listed test users. Publish the app in the consent screen settings so any Google account can sign in.
My password reset or confirmation emails link to the wrong page. Is it the same problem?
Usually yes. Supabase says the Site URL is critical for email confirmations and password resets, so a wrong Site URL breaks those links too. Fix it and send a fresh test email, since old emails keep the old link.
Is this safe to fix myself, or should I hire someone?
The address checks above are safe for most owners if you change one setting at a time. If sign-in still fails, or users can see data that is not theirs, get a developer to look. See hiring a Lovable developer.
More in this topic: Problem solving: AI-built and no-code apps (26 guides) →