> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lovable.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Google authentication to your app

> Add Sign in with Google to your app, managed by Lovable with no setup or with your own Google Cloud OAuth credentials and consent screen.

> [!NOTE]
>
> This page documents **Google authentication for your app's users**. It is available only for apps using the [built-in backend](https://docs.lovable.dev/features/cloud). For an overview of all sign-in methods, see [Users and authentication](https://docs.lovable.dev/features/authentication).

**Sign in with Google** lets people sign in with the Google account they already have, instead of creating a password for your app. Google has already verified their email address and passes it to your app.

> [!TIP]
>
> Building an internal tool for your own workspace members? On Business and Enterprise, your app can recognize members who are logged in to Lovable, with no Google sign-in at all. See [Reuse Lovable workspace identity in your app](https://docs.lovable.dev/features/lovable-workspace-identity-reuse.md).

## Choose a setup option

Users sign in the same way with both options. The options differ in who manages the credentials and what Google's consent screen shows.

| Option | Choose it when |
| - | - |
| **Managed by Lovable** (the default) | You want sign-in working without any setup. Lovable manages the OAuth client, the redirect handling, and the security updates. |
| **Your own credentials** | You want Google's consent screen to show your own app name and verified domain, or you need to own the credentials for security or compliance reasons. You connect credentials from your own Google Cloud project and keep them current yourself. |

> [tab] Managed by Lovable (default)
>
> With **Managed by Lovable**, Google's consent screen shows Lovable as the app that requests access. The first time a user signs in to your app, Lovable also shows its own consent page with your project's name, which asks the user to share their email address and basic profile information.
>
> After the user approves, they return to your app, signed in. Lovable's consent page does not appear again after their first sign-in to your app.
>
> **1. Ask Lovable to add Google sign-in**
>
> In the project chat, ask:
>
> ```text wrap theme={null}
> Add Google login to my app so that users can sign in with their Google account
> ```
>
> Lovable enables Google sign-in in **More → Users → Settings → Google**. Lovable also adds the sign-in flow to your app: the **Sign in with Google** button, tracking who is signed in, and signing out. You can review the changes in the **Details** view.
>
> **2. Test the flow**
>
> Verify that:
>
> * a **Sign in with Google** button appears on your login page
> * users are redirected to Google to sign in
> * users return to the app in a signed-in state
> * users can sign out

> [tab] Your own credentials
>
> With your own credentials, your Google Cloud project controls the consent screen, including the app name and branding. Lovable does not change the consent screen.
>
> **1. Create OAuth credentials in Google Cloud**
>
> In the [Google Cloud Console](https://console.cloud.google.com):
>
> 1. Select or create a Google Cloud project.
> 2. Configure the **OAuth consent screen**.
> 3. Create an **OAuth Client ID** of type **Web application**.
>
> For the full walkthrough, see Google's [Google Auth Platform documentation](https://support.google.com/cloud/topic/15540269).
>
> **2. Enter your credentials in Lovable**
>
> Go to **More → Users → Settings → Google**. Enable **Google sign-in**, select **Your own credentials**, and enter your **Client ID** and **Client secret**.
>
> **3. Add the redirect URIs in Google Cloud**
>
> Lovable can list more than one redirect URI: one for your default address, such as `https://your-app.lovable.app`, and one for each custom domain you added, such as `https://www.yourdomain.com`.
>
> In Google Cloud Console, add every redirect URI you plan to use as an **Authorized redirect URI** on your OAuth client.
>
> > [!NOTE]
> >
> > Each redirect URI must match exactly, including the scheme, domain, path, and trailing slash.
>
> **4. Select the redirect URIs you added**
>
> Return to Lovable and select each redirect URI you added in Google Cloud, then click **Save**. Lovable sends Google one of the redirect URIs you select, so select only URIs you added in Google Cloud.
>
> When you enable Google sign-in in the settings, Lovable also sends a message to the project chat on your behalf and adds the **Sign in with Google** button to your app. That message is treated as standard build usage and consumes credits.
>
> **5. Add the sign-in button if your app does not have it**
>
> If Google sign-in was already enabled before you switched to your own credentials, ask in the project chat:
>
> ```text wrap theme={null}
> Add Google sign-in to my app using my own Google OAuth credentials.
> ```
>
> Lovable adds the **Sign in with Google** button, which uses your own credentials.
>
> **6. Test the flow**
>
> Before you publish your app, verify that:
>
> * a **Sign in with Google** button appears on your login page
> * Google's consent screen shows your app's name
> * users return to the app in a signed-in state
> * users can sign out

## Managing Google authentication

You can switch between **Managed by Lovable** and **Your own credentials** at any time from **More → Users → Settings → Google**. Switching does not affect existing user accounts, so users keep signing in with the same Google accounts.

To stop offering Google sign-in, disable the provider in the auth settings. Lovable then sends a message to the project chat on your behalf and removes the Google sign-in button from your app. That message is treated as standard build usage and consumes credits. Users who signed up with Google keep their accounts but need another enabled sign-in method to get back in.

If you use your own credentials and connect a [custom domain](https://docs.lovable.dev/features/custom-domain) later, Lovable adds a redirect URL for that domain to the list in **More → Users → Settings → Google** but does not select it, so Google sign-in keeps using your other selected redirect URIs. To use the new one, add it as an **Authorized redirect URI** on your OAuth client in Google Cloud Console first, then select it in Lovable and click **Save**. If you select it before you add it in Google Cloud, Google sign-in fails with a redirect URI mismatch error. **Managed by Lovable** needs no change when you connect a domain.

> [!NOTE]
>
> Some projects that set up their own credentials earlier show a third option, **(Legacy) Your own credentials**. **(Legacy) Your own credentials** is deprecated. Switch to **Your own credentials** to get automatic updates and the current branding and security features.

## Troubleshooting your own credentials setup

> [accordion] Redirect URI mismatch
>
> The redirect URIs you selected in Lovable do not match the **Authorized redirect URIs** on your OAuth client. Add every URI you selected in Lovable to Google Cloud, and check that each one matches exactly, including the scheme (`https`) and any trailing slash.

> [accordion] Google blocks sign-in at the consent screen
>
> Check the **OAuth consent screen** configuration in Google Cloud. If your Google Cloud app is not published, add your own account as a test user.

> [accordion] Sign-in fails with a mobile or desktop OAuth client
>
> Lovable's redirect flow needs an OAuth client of type **Web application**. Mobile and desktop client types do not work with it. Create a **Web application** client and enter its credentials in Lovable.

> [accordion] Google sign-in still does not work
>
> Check that Google sign-in is enabled in **More → Users → Settings → Google**, and that the **Client ID** and **Client secret** match your OAuth client. If both are correct, ask Lovable in the project chat to check that your app's sign-in button is connected to the backend.

## FAQ

> [accordion] Is the Lovable-managed Google authentication available for all Lovable apps?
>
> No. **Managed by Lovable** Google authentication is available only for apps using the [built-in backend](https://docs.lovable.dev/features/cloud).

> [accordion] Can I use Google authentication without the built-in backend?
>
> Yes, but you set it up yourself outside Lovable. For example, you might:
>
> * integrate Google OAuth directly in your frontend or backend code
> * use Google's One Tap or standard OAuth sign-in flows
> * use a third-party authentication service such as Supabase Auth
> * manage OAuth credentials, redirect handling, and sessions yourself
>
> This page covers Google sign-in on the built-in backend only.

> [accordion] Should I use the managed by Lovable option or my own credentials?
>
> Use **Managed by Lovable** unless you specifically need to manage your own Google Cloud OAuth credentials or customize the consent screen branding.

> [accordion] What information does Google share with my app?
>
> Google provides the user's **email address** and **basic profile information**. Your app does not get access to other data in the user's Google account, with either setup option.

> [accordion] Do users see the Google consent screen every time they sign in?
>
> No. Lovable's consent page appears only the **first time** a user signs in to your app with Google.

> [accordion] Can I switch between "managed" and "your own credentials" later?
>
> Yes. You can switch between **Managed by Lovable** and **Your own credentials** at any time. Existing user accounts are not affected.

> [accordion] Why am I seeing a redirect URI mismatch error?
>
> The redirect URLs you selected in Lovable usually do not exactly match the **Authorized redirect URIs** in Google Cloud.
>
> * Add every redirect URL you selected in Lovable to Google Cloud.
> * Check the scheme, domain, path, and trailing slashes.

> [accordion] Does Google authentication replace email/password sign-in?
>
> No. Google authentication is an additional sign-in method. You can offer Google sign-in alongside other authentication methods.

> [accordion] Can a native app built outside Lovable use Google's native sign-in with my project's backend?
>
> Not when Google's native sign-in uses a separate client ID for the app. Lovable accepts one client ID for Google sign-in: its own with **Managed by Lovable**, or the one you enter with your own credentials. Instead, have the app open Google sign-in in the browser. Add the app's custom scheme, such as `myapp://callback`, to **Redirect URLs** in the auth settings. See [Site URL and redirect URLs](https://docs.lovable.dev/features/authentication#site-url-and-redirect-urls).

> [accordion] Do I need to configure Google Cloud Console when using "Managed by Lovable" setup?
>
> No. You configure Google Cloud Console only when you use **your own credentials**.
