Publish the config file with:
php artisan vendor:publish --tag=microsoft-oauth-config
Copies config/microsoft-oauth.php into your app. If you leave it unpublished, the package uses its own defaults — the env vars below still apply.
Full reference
return [
'driver' => env( 'MICROSOFT_OAUTH_DRIVER', 'config' ),
'mode' => env( 'MICROSOFT_OAUTH_MODE', 'direct' ),
'broker' => [
'url' => env( 'MICROSOFT_OAUTH_BROKER_URL' ),
'site_id' => env( 'MICROSOFT_OAUTH_BROKER_SITE_ID' ),
'site_secret' => env( 'MICROSOFT_OAUTH_BROKER_SITE_SECRET' ),
'return_url' => env( 'MICROSOFT_OAUTH_BROKER_RETURN_URL' ),
],
'client_id' => env( 'MICROSOFT_OAUTH_CLIENT_ID' ),
'client_secret' => env( 'MICROSOFT_OAUTH_CLIENT_SECRET' ),
'redirect_uri' => env( 'MICROSOFT_OAUTH_REDIRECT_URI' ),
'tenant' => env( 'MICROSOFT_OAUTH_TENANT', 'common' ),
'prompt' => env( 'MICROSOFT_OAUTH_PROMPT', 'select_account' ),
'routes' => [
'redirect_after_connect' => env( 'MICROSOFT_OAUTH_REDIRECT_AFTER_CONNECT', '/' ),
'redirect_after_error' => env( 'MICROSOFT_OAUTH_REDIRECT_AFTER_ERROR', '/' ),
],
'user_model' => env( 'MICROSOFT_OAUTH_USER_MODEL', 'App\\Models\\User' ),
];
Keys
driver
Which storage driver backs the app credentials (client_id, client_secret, tenant, and optionally redirect_uri).
config(default) — reads from.env/config/microsoft-oauth.php. Read-only.database— reads and writesmicrosoft_oauth_configurations. Client secret encrypted at rest.cms— reads and writes CMS framework Settings. Client secret encrypted at rest. Requiresartisanpack-ui/cms-framework; pickingcmswithout the framework installed throws at boot.
The service provider re-reads this value on every ConfigurationRepository resolve, so runtime overrides work.
Full comparison: Credential Drivers.
mode
Added in 1.1.0.
direct(default) — talk to Microsoft with this app's own client ID, secret, and tenant.broker— run connect, callback, and refresh through an OAuth broker using thebrokersettings below. The site holds no Microsoft client secret, and the broker owns the tenant authority.
Full guide: Broker Mode.
broker.url / broker.site_id / broker.site_secret / broker.return_url
Added in 1.1.0. Used only when mode is broker.
url— broker base URL. Must be HTTPS. Plain HTTP is only accepted forlocalhost,*.localhost,*.test, and loopback IPs.site_id— this site's ID at the broker.site_secret— this site's secret ({id}|{plain}), sent as the bearer token and used to sign/authorizelinks.return_url— where the broker sends the browser back. Defaults toroute('microsoft.auth.callback'), and must be on the URL the site registered with the broker.
url, site_id, and site_secret can also be supplied at runtime through the ap.microsoft.oauth.broker.credentials filter.
client_id / client_secret / redirect_uri
client_id and client_secret are used by the config driver only. The database and cms drivers read them from their own storage. redirect_uri is the fallback for every driver: the database and cms drivers use it when they have no redirect URI stored. None of these are used in broker mode.
client_id— the Application (client) ID from your Entra app registration.client_secret— the Value of a client secret from Certificates & secrets. Optional for public clients (SPA / native); confidential (web) clients should always provide one.redirect_uri— must exactly match a redirect URI registered on the Entra app. Character-for-character (scheme, host, port, path, trailing slash — all significant).
tenant
Which Microsoft tenant this app authorizes against. Accepted values:
common— any Microsoft account (work, school, personal).organizations— work / school accounts only.consumers— personal Microsoft accounts only.- A tenant GUID (
aaaa1111-…) — single-tenant. - A verified domain (
contoso.com,contoso.onmicrosoft.com) — single-tenant; Microsoft resolves the domain to a specific tenant.
Enforced on callback against the tid claim in the returned id_token. See Tenants for the full rules.
prompt
Passed through to Microsoft's prompt parameter on the initial connect URL. Common values:
login— always show the login screen.none— silent auth; fails withinteraction_requiredif consent is needed.consent— always show the consent screen.select_account(default) — let the user pick which Microsoft account to sign in with.
Incremental consent (/reauthorize) always uses prompt=consent, regardless of this value.
routes.redirect_after_connect
Where to send the user after a successful connect or reauthorize. Value may be a named route or an absolute / relative URL. A microsoft.status flash is attached: connected after connect, already-authorized after a reauthorize where nothing needed consent.
routes.redirect_after_error
Where to send the user when the flow fails. A microsoft.error flash carries the error message. In broker mode, a microsoft.renew_url flash may also be set when the broker reports a lapsed license with a renewal link on its own host. See Broker Mode → License expiry.
Read it in your redirect target:
@if( session( 'microsoft.error' ) )
<div class="alert alert-error">{{ session( 'microsoft.error' ) }}</div>
@endif
user_model
Fully-qualified class name of the application's user model. Used by MicrosoftConnection::user() for the belongsTo relationship. Defaults to App\Models\User.
Any Eloquent model works; the OAuth flow calls Auth::user()->getAuthIdentifier(), so whatever model is behind the web guard needs that method (every Eloquent auth model has it).
Routes are not configurable
Unlike some sibling packages, the route prefix, middleware, and route names are fixed:
- Prefix:
/auth/microsoft - Middleware:
web,auth(connect / reauthorize) andweb(callback) - Names:
microsoft.auth.connect,microsoft.auth.reauthorize,microsoft.auth.callback
If your app needs a different URL structure, set config('microsoft-oauth.driver') and other options as usual, then skip the package's routes by wiring your own controller that calls OAuthManager::authorizationUrl() / handleCallback() directly — see OAuth → Connect.

