Add Microsoft authentication to your app
Allow users to log in with their personal or work Microsoft accounts. Lovable can handle the setup automatically with zero configuration, or you can connect your own Azure account for custom branding and restricted access.
Anyone building an app on Lovable's built-in backend who wants users to sign in with Microsoft.
Do this, in order
- 1
Ask Lovable in your project chat to add a Microsoft sign-in button to your app.
Lovable turns on Microsoft login in your settings and adds the button to your login screen with no external accounts needed.
- 2
If you want your own app name on the login screen or want to restrict access to your company, open More, go to Users, click Settings, select Microsoft, and choose Your own credentials.
This allows you to connect an Azure app registration so you can control which accounts can log in and present your own branding.
- 3
If using your own credentials, copy every URL shown in the Redirect URL(s) section in Lovable into your Azure portal under Authentication for Web platforms.
Microsoft blocks sign-in redirects unless the exact URLs match what is registered in Azure.
- 4
Test the sign-in button on your login page with an allowed Microsoft account.
This verifies that users are redirected back into your app signed in and appear in your project's user list.
Paste this into your project
Add a Microsoft sign-in button to my app.
Words decoded
- OAuth
- A secure system that lets users log in using an existing account (like Microsoft) without sharing their password with your app.
- Tenant ID
- A unique code that identifies a specific organization in Microsoft, allowing you to restrict logins only to people in that company or school.
- Client secret
- A private password generated in Azure that allows Lovable to securely communicate with Microsoft on your behalf.
Where people get stuck
- Azure client secrets expire on a set date; when they do, Microsoft login stops working until you create a new secret in Azure and update Lovable.
- Switching back to Managed by Lovable or disabling Microsoft login wipes your saved Azure credentials and redirect URLs.
- In Managed by Lovable mode, the Microsoft permission screen will show Lovable's name instead of your app's name, and any Microsoft user can sign in.
- Whenever you attach a new custom domain to your project, you must manually add the new redirect URL to your Azure app registration.
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.