[Unreleased]
[1.1.0] - 2026-10-02
Adds a broker client mode and stateless OAuth relay primitives, so a site can
connect through an OAuth broker without holding a Microsoft client secret, and
a broker can be built on this package. Default direct-mode behavior is
unchanged.
Added
- Stateless relay primitives for OAuth brokers (#24).
MicrosoftOAuth::client( ?MicrosoftCredentials )returns aMicrosoftClientbuilt from runtime credentials (client ID, optional secret, tenant, redirect URI) or the configured driver, and never touches the session or database.authorizationUrl()takes the caller'sstate, scopes, extra parameters (prompt,login_hint, …) and an optional PKCE verifier.exchangeCode()sends the requested scopes with the code, keeps thetidcheck against the tenant authority, and returns aTokenResponse.refresh()takes a raw refresh-token string plus the scopes, with noMicrosoftConnectionrequired.MicrosoftClient::verifyState()checks the caller's state. TokenResponsevalue object: access token, rotated refresh token, expiry, granted scopes, id_token, and identity from the id_token (oid/sub,email/preferred_username,name,tid).toArray()renders the broker's wire shape.- Broker client mode (
MICROSOFT_OAUTH_MODE=broker). Connect, callback and refresh run through an OAuth broker using onlymicrosoft-oauth.broker.url,site_idandsite_secret, so the site holds no Microsoft client secret and the broker owns the tenant authority. Signed/authorizelinks, one-time code exchange at/token, refreshes at/refresh, and incremental consent passing the scope union throughscopes=.return_urldefaults to the package callback route. Broker credentials can come from theap.microsoft.oauth.broker.credentialsfilter.MicrosoftOAuth::broker()andMicrosoftOAuth::usesBroker()expose the client and mode. The broker URL must be HTTPS (plain HTTP only forlocalhost,*.localhost,*.testand loopback hosts). LicenseExpiredException(extendsTokenRefreshException) for the broker's402 license_expiredrefresh response, carryinggetRenewUrl(). The connection stays connected, unlike a revoked grant. The callback flashes a broker-hostrenew_urlasmicrosoft.renew_url.OAuthExceptionandTokenRefreshExceptionexpose the OAuth error code viagetError().- Optional
ProvidesRedirectUricontract (getRedirectUri()) so credential drivers can supply the redirect URI. All three bundled drivers implement it: the database driver stores it in a new nullableredirect_uricolumn, and the CMS driver in theartisanpack_microsoft_oauth_redirect_urisetting. When a driver has none (or doesn't implement the contract),microsoft-oauth.redirect_uriis used, as before.ConfigurationRepositoryitself is unchanged, so custom drivers keep working.
Changed
OAuthManager::handleCallback()andTokenManager::refresh()are now thin wrappers that run the stateless primitives and then persist toMicrosoftConnection. Behavior in the defaultdirectmode is unchanged.- Refreshes now validate the configured tenant like the authorization flow does; an invalid tenant raises
TokenRefreshException(getError()isinvalid_tenant) without disconnecting the connection. - The
OAuthExceptionandTokenRefreshExceptionconstructors are now( string $message = '', ?string $error = null, ?string $renewUrl = null, ?Throwable $previous = null ). The second argument is the OAuth error code instead of an integer exception code. TokenManagertakes an optional third constructor argument (the config repository), resolved from the container when omitted.- A new migration adds a nullable
redirect_uricolumn tomicrosoft_oauth_configurations. Runphp artisan migrateafter upgrading.
Documentation
- New Broker Mode, Stateless Client, and Upgrading guides, plus API reference pages for
MicrosoftClient/MicrosoftCredentials,BrokerClient/BrokerCredentials, andTokenResponse. - Updated the configuration, environment variable, driver, OAuth flow, token, tenant, exception, testing, and FAQ docs for broker mode, the driver-supplied redirect URI, and the new error codes.
[1.0.0] - 2026-09-18
First stable release of artisanpack-ui/microsoft-oauth: the shared Microsoft
identity platform (Entra / Azure AD) OAuth2 broker that powers ArtisanPack UI's
Microsoft service integrations.
Added
- Microsoft identity platform v2.0 authorization-code flow, including PKCE, the authorize redirect, and the callback exchange (#2).
- Encrypted token storage with automatic refresh: access and refresh tokens are encrypted at rest and refreshed transparently ahead of expiry (#3).
ScopeRegistryfor declaring the scopes a connection needs, exposed through theap.microsoft.oauth.scopesfilter hook so other packages can extend the scope set (#4).- Configuration repository with pluggable drivers: a
configdriver backed by Laravel config and adatabasedriver for runtime-editable credentials (#5). - CMS Settings bridge for the
databasedriver so admins can edit Microsoft credentials through the ArtisanPack UI CMS Settings module, with guards for a missing CMS framework and for decrypt-failure config drift (#6). - Incremental consent flow that re-prompts the user when a new service adds scopes to an existing connection (#7).
TokenProvidercontract andMicrosoftOAuthManager::request()consumer API so downstream packages fetch tokens through a single, refresh-aware entry point (#8).- Multi-tenant vs single-tenant support with configured tenant-authority
validation and
id_tokentidclaim enforcement so tokens from unexpected tenants are rejected (#9). - Comprehensive Pest test coverage for the OAuth callback, refresh path, scope registry, and configuration repository (#11).
Documentation
- Full README and
docs/tree covering installation, drivers, the OAuth flow, tenants, scopes, tokens, the connection model, API reference, testing, FAQ, and contributing, plus an Entra / Azure AD app-registration walkthrough with redirect URI, client secret, API permissions, and single- vs. multi-tenant guidance (#10).

