manageengine-mdm
Version:
A TypeScript wrapper for the ManageEngine Mobile Device Manager Plus API
31 lines (30 loc) • 1.07 kB
TypeScript
import { AuthConfig, AuthState } from './types';
export declare class AuthManager {
private readonly config;
private readonly tokenStorage;
constructor(config: AuthConfig);
/**
* Get the authorization URL that the user needs to visit to grant access
*/
getAuthorizationUrl(accessType?: 'online' | 'offline', prompt?: 'consent'): string;
/**
* Initialize the client with an authorization code
*/
authenticateWithCode(code: string, accountsServer: string): Promise<void>;
/**
* Initialize the client with a refresh token
*/
authenticateWithRefreshToken(refreshToken: string, accountsServer: string): Promise<void>;
/**
* Get the current authentication state
*/
getAuthState(accountsServer: string): Promise<AuthState | undefined>;
/**
* Get a valid access token, refreshing if necessary
*/
getValidToken(accountsServer: string): Promise<string>;
/**
* Clear the stored authentication state
*/
clearAuthState(accountsServer: string): Promise<void>;
}