Add Google authentication to your app
You can let users log in with their Google accounts using Lovable's built-in backend. Lovable handles the entire setup automatically by default, or you can connect credentials from your own Google Cloud project.
Anyone building an app with user accounts who wants fast, password-free sign-in for their visitors.
Do this, in order
- 1
Prompt Lovable in chat to add Google login to your app.
Lovable automatically enables Google authentication in your backend settings, builds the sign-in buttons, and sets up sign-out controls.
- 2
If you require custom branding, navigate to More -> Users -> Settings -> Google and choose 'Your own credentials'.
This allows you to supply your own Google Client ID and secret if company policy or custom scopes require your own Google Cloud project.
- 3
If using your own credentials, copy Lovable's redirect web addresses into your Google Cloud Web OAuth client and check the matching boxes in Lovable before saving.
Google will block sign-in attempts unless the exact return addresses match on both sides.
- 4
Test the login flow in your preview window by signing in with a Google account and then signing back out.
Testing ensures the approval window pops up as expected and returns you to the app in a logged-in state.
Paste this into your project
Add Google login to my app so that users can sign in with their Google account
Words decoded
- OAuth
- A secure sign-in method that lets people log in with Google without giving your app their Google password.
- Redirect URI
- The exact web address Google sends a user back to after they click approve on the sign-in screen.
- Consent screen
- The Google popup window where users confirm they want to share their name and email with your app.
- Client ID and Client secret
- A username and password pair that Google gives you so it recognizes your app.
Where people get stuck
- Managed Google authentication only works with Lovable's built-in backend, not with external custom backends.
- If using your own credentials, your Google Cloud OAuth client must be set to 'Web application' (mobile or desktop types will fail).
- Redirect web addresses must match character-for-character between Google Cloud and Lovable, including trailing slashes and https.
- If you use your own credentials and attach a custom domain later, you must add the new domain's redirect link to Google Cloud and enable it in Lovable or logins will break.
The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.