This guide walks you through configuring Microsoft as a social login provider for your application.Documentation Index
Fetch the complete documentation index at: https://docs.prelude.so/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Microsoft Azure account
- Your Microsoft OAuth Application (client) ID and Client Secret
Configure Microsoft OAuth
Register an application on Azure
- Go to the Azure Portal
- Navigate to Microsoft Entra ID > App registrations
- Click New registration
- Enter a name (e.g. “Prelude Session”)
- Under Supported account types, select the option that fits your needs (e.g. “Accounts in any organizational directory and personal Microsoft accounts”)
- Click Register
- Copy the Application (client) ID — you will need it in the next step
Set the redirect URI
- In your app registration, go to Manage > Authentication
- Click Add a platform > Web
- Enter the following redirect URI:
${YOUR_CUSTOM_DOMAIN} with your custom domain (e.g. session.yourapp.com).- Click Configure
The redirect URI must match exactly. Make sure there is no trailing slash and that you are using
https.Create a client secret
- In your app registration, go to Certificates & secrets
- Click New client secret
- Enter a description and select an expiration period
- Click Add
- Copy the Value (not the Secret ID) — you will need it in the next step
Enable the xms_edov optional claim (required for account merge)
Microsoft does not emit a standard
email_verified claim and the email value in a Microsoft ID token is not proof of mailbox ownership — a tenant admin can set any arbitrary email on a user they control. This is the nOAuth account-takeover vector.Session treats a Microsoft email as verified only when the xms_edov (Email Domain Owner Verification) optional claim is present and true. You must enable this claim in Azure for allow_email_account_merge to work with Microsoft; otherwise every Microsoft login is treated as unverified and a new Session user is created on each sign-in instead of merging.- In your app registration, go to Manage > Token configuration
- Click Add optional claim
- Select ID as the token type
- Check email and xms_pdl (required to trigger
xms_edovemission), then click Add - When prompted, check Turn on the Microsoft Graph email permission and confirm
- Click Add optional claim again, select ID, check xms_edov, then click Add
xms_edov is issued as true when the email’s domain is verified by the tenant (enterprise users) or for personal Microsoft accounts where the email was verified at account creation. It is issued as false — or omitted entirely — when the email is user-editable or domain ownership cannot be proven.Create the Microsoft OAuth configuration
| Field | Description |
|---|---|
client_id | Your Microsoft Application (client) ID. |
client_secret | Your Microsoft client secret value. |
enabled | Set to true to enable Microsoft login. |
options.use_email_as_identifier | When true, the user’s Microsoft email is stored as an email identifier — only when the email is verified via xms_edov. |
options.allow_email_account_merge | When true, an incoming Microsoft identity is linked to an existing Session user whose email matches — only when the email is verified via xms_edov. An unverified email that collides with an existing user is rejected with an email_in_use error rather than auto-merged. |
Security: email verification with Microsoft
Unlike Google and Apple, Microsoft does not guarantee theemail claim in its ID token is owned by the signed-in user. Any tenant admin can set an arbitrary email on a user in their tenant, and Microsoft does not emit an email_verified claim. Session therefore relies on the xms_edov optional claim as the sole source of truth for Microsoft email verification:
xms_edovis present andtrue→ Session treats the Microsoft email as verified.use_email_as_identifierandallow_email_account_mergeapply normally.xms_edovisfalse, missing, or any other value → Session treats the Microsoft email as unverified. No email identifier is stored, no auto-merge happens, and ifallow_email_account_mergeis enabled and the email collides with an existing Session user the flow is rejected withemail_in_use(protecting against the nOAuth takeover vector).
xms_edov configuration step above, Microsoft sign-in will still work but every Microsoft user will be created as a fresh Session account and email-based account merge will never fire.
Alternative: verify the email via OTP
When you cannot enablexms_edov (e.g. you do not control the Azure app registration), set options.verify_email to true instead. Session will detect the unverified Microsoft email and challenge the user with an email OTP before linking the OAuth identifier — preserving the nOAuth protection while still letting users sign in. This requires use_email_as_identifier=true and at least one email OTP login config on the application.