ReadonlyisObservable that emits true if the user is authorized, otherwise false.
ReadonlyisObservable that emits true when the auth context is initialized.
ReadonlykeepWhether the server is configured to keep users logged in by auto-refreshing before session expiry.
Provided by the backend via the keep-user-logged-in attribute on <umb-app>.
Readonlysession$ReadonlytimeoutObservable that acts as a signal and emits when the user has timed out, i.e. the token has expired. This can be used to show a timeout message to the user.
Observable that acts as a signal for when the authorization state changes.
An observable that emits when the authorization state changes.
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsCompletes the login flow. This is called on the oauth_complete page to exchange the authorization code for tokens.
The token response timing, or null if no authorization was pending.
Configures a @hey-api/openapi-ts client for authenticated API calls.
Sets baseUrl, credentials, auth header, and binds the default response
interceptors (401 retry, error handling, notifications).
A @hey-api/openapi-ts client instance.
Callback method called when context is resolved.
Reference to the created Context Consumer Controller instance
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
Gets all registered auth providers.
Optionaloptions: UmbClassGetContextOptionsA Promise with the reference to the Context Api Instance
Checks if the user is authorized. If Authorization is bypassed, the user is always authorized.
True if the user is authorized, otherwise false.
Gets the latest token from the Management API. With cookie auth, this returns '[redacted]' — the real token is in the httpOnly cookie. If the session has expired, it will attempt a refresh first.
The latest token from the Management API
const token = await authContext.getLatestToken();
const result = await fetch('https://my-api.com', { headers: { Authorization: `Bearer ${token}` } });
Use configureClient for @hey-api/openapi-ts clients or getOpenApiConfiguration for manual fetch calls. With cookie-based auth this always returns '[redacted]'. Scheduled for removal in Umbraco 19.
@hey-api/openapi-ts clients.Get the default OpenAPI configuration, which is set up to communicate with the Management API.
The default OpenAPI configuration
This is useful if you want to communicate with your own resources generated by the @hey-api/openapi-ts library.
Gets the post logout redirect url.
The post logout redirect url, which is the backoffice path with the logout path appended.
Gets the authorized redirect url.
The redirect url, which is the backoffice path.
Checks if the current session is still valid.
True if the session has not expired.
Links the current user to the specified provider by redirecting to the link endpoint.
The provider to link to.
Initiates the login flow.
The provider to use for login. Default is 'Umbraco'.
Optionalredirect: booleanIf true, the user will be redirected to the login page.
OptionalusernameHint: stringThe username hint to use for login.
Optionalmanifest: ManifestAuthProviderThe manifest for the registered provider.
Attempts to refresh the token using Web Locks to prevent concurrent refresh requests.
True if the refresh was successful, otherwise false.
An Observable to observe from.
Optionalcallback: ObserverCallback<SpecificT>Callback method called when data is changed.
OptionalcontrollerAlias: null | UmbControllerAliasDefine an explicit controller alias. If not defined then one will be generated based on the callback function. If null is parsed no controller alias will be given.
Reference to the created Observer Controller instance.
The API instance to be exposed.
Reference to the created Context Provider Controller instance
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.
Optionaloptions: boolean | EventListenerOptionsSets the initial state of the auth flow. First asks existing tabs for their session via BroadcastChannel. If no peer responds, falls back to a server refresh.
Unlinks the current user from the specified provider.
Forces a token refresh against the server (calls /token) and returns true if successful.
Use this when you need to unconditionally refresh — e.g. session timeout keep-alive.
For per-request token handling, prefer configureClient which skips the network
call when the access token is still valid.
Uses Web Locks to deduplicate concurrent refresh requests across tabs.
True if the refresh succeeded, otherwise false
This base provides the necessary for a class to become a context-api controller.