Microsoft Entra ID
Resources
Section titled “Resources”Environment variables
Section titled “Environment variables”MICROSOFT_CLIENT_ID=MICROSOFT_CLIENT_SECRET=
Callback URL
Section titled “Callback URL”Under your app registration’s “Authentication” settings, you need to add a “Web” platform and configure the redirect URI.
/api/auth/microsoft/callback
Microsoft allows adding multiple redirect URIs, so add both your development and production URLs.
Config
Section titled “Config”The openid
, profile
, email
, and User.Read
scopes are requested by default.
import process from 'node:process'import { createAuth } from '@rttnd/gau/core'import { Microsoft } from '@rttnd/gau/oauth'
export const auth = createAuth({ providers: [ Microsoft({ clientId: process.env.MICROSOFT_CLIENT_ID, clientSecret: process.env.MICROSOFT_CLIENT_SECRET, }), ],})
Provider params
Section titled “Provider params”tenant
Section titled “tenant”Type:
'common' | 'organizations' | 'consumers' | (string & {})
Default:
'common'
The tenant segment used in the authorize and token endpoints. You can also pass a specific tenant ID.
"consumers"
is personal accounts only."organizations"
is work/school accounts only."common"
works with both.
prompt
Section titled “prompt”Type:
'login' | 'none' | 'consent' | 'select_account' | (string & {})
Optional prompt behavior to request at Microsoft.
params
Section titled “params”Type:
Record<string, string>
Extra query params appended to the authorization URL.