documentation
This commit is contained in:
@@ -2,21 +2,31 @@ import type { UmbLoggedInUser } from './types.js';
|
||||
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
|
||||
|
||||
export interface IUmbAuth {
|
||||
/**
|
||||
* Initiates the login flow.
|
||||
*/
|
||||
login(): void;
|
||||
|
||||
/**
|
||||
* Initialise the auth flow.
|
||||
*/
|
||||
setInitialState(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Get the current user's access token.
|
||||
* Gets the latest token from the Management API.
|
||||
* If the token is expired, it will be refreshed.
|
||||
*
|
||||
* NB! The user may experience being redirected to the login screen if the token is expired.
|
||||
*
|
||||
* @example
|
||||
* ```js
|
||||
* const token = await auth.getAccessToken();
|
||||
* const token = await authContext.getLatestToken();
|
||||
* const result = await fetch('https://my-api.com', { headers: { Authorization: `Bearer ${token}` } });
|
||||
* ```
|
||||
*
|
||||
* @returns The latest token from the Management API
|
||||
*/
|
||||
performWithFreshTokens(): Promise<string>;
|
||||
getLatestToken(): Promise<string>;
|
||||
|
||||
/**
|
||||
* Get the current user model of the current user.
|
||||
@@ -34,7 +44,7 @@ export interface IUmbAuth {
|
||||
fetchCurrentUser(): Promise<UmbLoggedInUser | undefined>;
|
||||
|
||||
/**
|
||||
* Sign out the current user.
|
||||
* Signs the user out by removing any tokens from the browser.
|
||||
*/
|
||||
signOut(): Promise<void>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user