The public surface of artisanpack-ui/microsoft-oauth.
Sub-pages by class:
MicrosoftOAuth— the facade / helper rootOAuthManager— the authorization-code flowMicrosoftClient+MicrosoftCredentials— stateless OAuth primitivesBrokerClient+BrokerCredentials— the OAuth broker clientTokenResponse— exchange / refresh resultMicrosoftOAuthManager— the bearer-ready HTTP client wrapperTokenManagerTokenProvider(contract) +DefaultTokenProviderScopeRegistryConfigurationRepository(contract + three drivers) andProvidesRedirectUriMicrosoftConnectionTenantAuthority+TenantMode- Exceptions
The facade
use ArtisanPackUI\MicrosoftOAuth\Facades\MicrosoftOAuth;
MicrosoftOAuth::request( $userId ); // PendingRequest with bearer token
MicrosoftOAuth::client(); // stateless MicrosoftClient (1.1.0)
MicrosoftOAuth::broker(); // BrokerClient (1.1.0)
MicrosoftOAuth::usesBroker(); // bool (1.1.0)
The facade wraps the MicrosoftOAuth class, which itself is a thin aggregator over MicrosoftOAuthManager. Prefer injecting the TokenProvider contract or the MicrosoftOAuthManager in downstream packages; the facade exists for call sites where DI is more ceremony than the call warrants.
The helper
microsoft_oauth(); // same as app( 'microsoft-oauth' )
Returns the ArtisanPackUI\MicrosoftOAuth\MicrosoftOAuth instance. Equivalent to using the facade — pick whichever style matches your codebase.
Container bindings
The service provider registers:
| Abstract | Concrete | Scope |
|---|---|---|
microsoft-oauth |
ArtisanPackUI\MicrosoftOAuth\MicrosoftOAuth |
Singleton |
ConfigDriver::class |
(self) | Singleton |
DatabaseDriver::class |
(self) | Scoped |
CmsSettingsDriver::class |
(self) | Scoped |
ConfigurationRepository::class |
ConfigDriver / DatabaseDriver / CmsSettingsDriver (per microsoft-oauth.driver) |
Bind (re-resolved per lookup) |
ScopeRegistry::class |
(self) | Singleton |
OAuthManager::class |
(self) | Scoped |
TokenManager::class |
(self) | Scoped |
TokenProvider::class |
DefaultTokenProvider |
Scoped |
MicrosoftOAuthManager::class |
(self) | Scoped |
Rebind ConfigurationRepository (or TokenProvider) to swap in a custom implementation — the Google-style aggregator resolves them fresh on every facade call.
Why so many scoped() bindings? The credential-loading drivers (DatabaseDriver, CmsSettingsDriver) hold a per-request row cache. On Octane / long-lived queue workers, a singleton binding would keep serving stale credentials for the lifetime of the worker after another lifecycle rewrote the row. scoped() bindings are flushed between requests / jobs, so each lifecycle gets a freshly-loaded cache. The manager classes (OAuthManager, TokenManager, TokenProvider, MicrosoftOAuthManager) capture a ConfigurationRepository reference in their constructor, so they inherit the same scoped()ness by transitivity.
Namespace map
ArtisanPackUI\MicrosoftOAuth\
├── MicrosoftOAuth.php — the aggregator
├── MicrosoftOAuthServiceProvider.php
├── helpers.php — microsoft_oauth() function
├── Broker\
│ ├── BrokerClient.php — OAuth broker client
│ └── BrokerCredentials.php
├── Facades\
│ └── MicrosoftOAuth.php — facade
├── Configuration\
│ ├── ConfigDriver.php
│ ├── DatabaseDriver.php
│ └── CmsSettingsDriver.php
├── Contracts\
│ ├── ConfigurationRepository.php
│ ├── ProvidesRedirectUri.php — optional driver contract
│ └── TokenProvider.php
├── OAuth\
│ ├── OAuthManager.php — authorization-code flow
│ ├── MicrosoftOAuthManager.php — bearer-ready HTTP client
│ ├── MicrosoftClient.php — stateless OAuth primitives
│ ├── MicrosoftCredentials.php
│ ├── TokenResponse.php
│ ├── TenantAuthority.php
│ ├── TenantMode.php — enum
│ └── IncrementalConsentResult.php — enum
├── Scopes\
│ └── ScopeRegistry.php
├── Tokens\
│ ├── TokenManager.php
│ └── DefaultTokenProvider.php
├── Models\
│ └── MicrosoftConnection.php
├── Http\
│ └── Controllers\
│ └── MicrosoftAuthController.php — the three routes
└── Exceptions\
├── Concerns\
│ └── CarriesOAuthError.php — getError() / getRenewUrl()
├── OAuthException.php
├── TokenRefreshException.php
├── LicenseExpiredException.php — extends TokenRefreshException
└── MissingConnectionException.php — extends OAuthException
Public routes
Reference: OAuth Flow → Routes
Publish tags
| Tag | What it publishes |
|---|---|
microsoft-oauth-config |
config/microsoft-oauth.php |
microsoft-oauth-migrations |
All three migrations to database/migrations/. |
Filter hooks
| Hook | Contract | Purpose |
|---|---|---|
ap.microsoft.oauth.scopes |
Filter — receives and returns array<int, string> |
Contribute scopes to the registry. Fires inside ScopeRegistry::all(). |
ap.microsoft.oauth.broker.credentials |
Filter — receives and returns array{url: ?string, site_id: ?string, site_secret: ?string} |
Supply broker credentials at runtime. Fires inside BrokerCredentials::fromConfig(). Added in 1.1.0. |
Enum types
| Enum | Cases | Purpose |
|---|---|---|
TenantMode |
Common, Organizations, Consumers, Tenant |
Categorizes a parsed tenant value into one of the four authority modes. See Tenants. |
IncrementalConsentResult |
NoConnection, AlreadyAuthorized |
Non-URL outcomes of OAuthManager::incrementalAuthorizationUrl(). See OAuth → Reauthorize. |
Continue to Testing →

