Get credentials
1
Register an application
Go to the Azure Portal and navigate to Microsoft Entra ID > App registrations > New registration.- Name: your app name
- Supported account types: choose based on your needs (see below)
- Redirect URI: Web,
https://auth.example.com/auth/oauth/microsoft/callback
2
Create a client secret
Navigate to Certificates and secrets > New client secret. Set an expiry and copy the secret value immediately.3
Copy the Application ID
From the app overview, copy the Application (client) ID and the Directory (tenant) ID.Configuration
- Personal + work accounts
- Work accounts only (single tenant)
lib/kavach.ts
Account types and tenant
Thetenant option maps to the Microsoft authority URL:
Scopes
Default scopes:openid email profile User.Read
User data returned
Personal Microsoft account profile photos require an additional Graph API call with
User.Read scope. Work account photos may be restricted by IT policy.