Welcome to the documentation for ArtisanPack UI Microsoft OAuth — the shared Microsoft identity platform (Entra / Azure AD) OAuth2 broker that powers every ArtisanPack UI Microsoft service integration.
Service packages like artisanpack-ui/bing-places and future Microsoft Graph integrations sit on top of this package — they contribute the scopes they need, then call the shared token manager (or its facade wrapper) to make authenticated API calls. They never handle OAuth themselves.
Use the navigation below to explore topics. Links use the GitLab / GitHub wiki page style, so you can jump between pages like Getting Started or OAuth Flow.
- Getting Started
- Installation
- Credential Drivers
- OAuth Flow
- Broker Mode
- Stateless Client
- Tenants
- Scopes
- Tokens
- Connection Model
- API Reference
- Testing
- FAQ
- Upgrading
- Contributing
If you're new here, start with Getting Started.
What this package does
artisanpack-ui/microsoft-oauth owns the shared plumbing every ArtisanPack UI Microsoft integration sits on top of. It provides:
- OAuth2 authorization-code + PKCE flow against the Microsoft identity platform v2.0 endpoint — builds the consent URL, exchanges the callback code, and extracts the user's Microsoft identity from the returned
id_token. - Encrypted token storage on a per-user
microsoft_connectionsmodel, with transparent refresh via the token manager. - A scope registry that lets any installed service package contribute the scopes it needs. Consent covers the union so users only see one screen.
- Tenant authority resolution —
common/organizations/consumers/ GUID / verified domain, withtidenforcement on callback. - Credential storage drivers (config, database, or CMS) so credentials (including the redirect URI) can live wherever a project already stores its secrets.
- Broker mode: run connect, callback, and refresh through an OAuth broker so the site never holds a Microsoft client secret.
- Stateless OAuth primitives (
MicrosoftOAuth::client()) that touch neither the session nor the database, for building brokers and custom flows. - A bearer-ready HTTP client —
MicrosoftOAuth::request( $userId )returns aPendingRequestpre-configured withAuthorization: Bearer …so downstream packages never touch OAuth internals.
What this package does not do
- It does not call Microsoft APIs. That is the responsibility of the service packages (Bing Places, Graph integrations, …).
- It does not ship a connection-management UI (Livewire / React / Vue). If you need one, mount your own button on
route('microsoft.auth.connect')and read connection state directly from theMicrosoftConnectionmodel. - It does not ship a
/disconnectroute. Marking a connection disconnected is a two-line call toMicrosoftConnection::markDisconnected()on whatever surface makes sense in your app. - It does not perform remote token revocation. If you need to invalidate the refresh token on Microsoft's side, POST to Microsoft's logout / token-revocation endpoints from your own code before you call
markDisconnected().

