KBAISE/ for lovable
Library
Docs

Sign in with Lovable

about 10 minBuildingchecked 5d agoOfficial page
The short version

You can let visitors log in to an external website using their existing Lovable accounts. A single script creates the sign-in button and securely returns the visitor's name, email, and user ID.

Anyone who wants to let people log in with a Lovable account on a website built outside of Lovable.

Do this, in order

  1. 1

    Go to Workspace settings, open API keys & OAuth, and register a new OAuth client.

    This generates your Client ID so Lovable knows sign-in requests come from your approved site.

  2. 2

    Select Single-page app if your site has no backend server, or Web server if you exchange tokens on your own server.

    Single-page apps handle login in the browser without a secret, while web servers use a secret key that must stay hidden.

  3. 3

    Add your exact site address as the Redirect URI and select scopes including openid, profile, and email.

    Lovable will only redirect users to URLs you explicitly list and will only share the profile details you requested.

  4. 4

    Paste the Lovable SDK script tag into your HTML and add the container div with your Client ID in the page head.

    The script automatically draws the branded sign-in button without requiring separate images or stylesheets.

  5. 5

    Add a JavaScript event listener for LovableSignInOnSuccess to receive the user details and save their sub identifier.

    The sub field never changes for a user, making it the only reliable identifier to store in your records.

Paste this into your project

Add the Sign in with Lovable SDK button to my login page. Include the official script from https://sdks.lovable.dev/sign-in-with-lovable/index.js, add the meta tags for client ID and scopes (openid profile email), add a styled container div with data-type='continue' and data-color='dark', and add a JavaScript listener for LovableSignInOnSuccess that displays the signed-in user's name and email.

Words decoded

OAuth client
A registered profile for your website that allows it to safely talk to Lovable's login system.
Scope
The specific pieces of personal information your site requests permission to view, like email or name.
Client ID
A public ID number that tells Lovable which website is asking the visitor to sign in.
Client secret
A private password for your server to prove its identity; it must never be shown in browser code.
sub
Short for subject, this is the permanent user ID from Lovable that never changes even if their email changes.

Where people get stuck

  • Do not use these manual steps for an app built inside Lovable; instead, enable Sign in with Lovable under More → Users → Settings.
  • Do not put a client secret into your front-end HTML or JavaScript where visitors can inspect and copy it.
  • Do not put a trailing slash at the end of your domain in the redirect URI when using the SDK.
  • Do not try to switch between Single-page app and Web server after registering, as the application type cannot be changed later.
  • Do not use non-HTTPS addresses in production; plain HTTP is only allowed for local testing on localhost.

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.