UNPKG

@tpointurier/ally-microsoft

Version:

An ally driver for Microsoft

40 lines (39 loc) 1.72 kB
import { ApiRequest, Oauth2Driver } from '@adonisjs/ally'; import type { HttpContext } from '@adonisjs/core/http'; import { MicrosoftDriverConfig, MicrosoftScopes, MicrosoftToken } from './types/main.js'; import type { ApiRequestContract, RedirectRequestContract } from '@adonisjs/ally/types'; export declare class MicrosoftDriver extends Oauth2Driver<MicrosoftToken, MicrosoftScopes> { config: MicrosoftDriverConfig; protected authorizeUrl: string; protected accessTokenUrl: string; protected userInfoUrl: string; protected codeParamName: string; protected errorParamName: string; protected stateCookieName: string; protected stateParamName: string; protected scopeParamName: string; protected scopesSeparator: string; constructor(ctx: HttpContext, config: MicrosoftDriverConfig); protected configureRedirectRequest(request: RedirectRequestContract<MicrosoftScopes>): void; protected configureAccessTokenRequest(request: ApiRequest): void; /** * Find if the current error code is for access denied */ accessDenied(): boolean; /** * Returns details for the authorized user */ user(callback?: (request: ApiRequestContract) => void): Promise<any>; /** * Finds the user by the access token */ userFromToken(token: string, callback?: (request: ApiRequestContract) => void): Promise<any>; /** * Fetches the user info from the Twitch API */ protected getUserInfo(accessToken: string, callback?: (request: ApiRequest) => void): Promise<any>; /** * Returns the HTTP request with the authorization header set */ protected getAuthenticatedRequest(url: string, token: string): ApiRequest; }