UNPKG

abowire

Version:

This is the official **Abowire Javascript SDK**, which makes it easy to connect to the Abowire **GraphQL API** and includes all the required dependencies you need.

50 lines (49 loc) 1.34 kB
import { Scope } from '../gen/graphql'; export type AuthConfig = (AuthorizationCodeConfig | ClientCredentialsConfig) & { checkSession?: boolean; enableLogging?: boolean; authFlow?: AuthenticationFlow; useStorage?: boolean; autoLogin?: boolean; }; export type AuthorizationCodeConfig = { clientId: string; scopes?: Scope[]; authUrl: string; }; export type ClientCredentialsConfig = { clientId: string; secret: string; scopes?: Scope[]; authUrl: string; }; export type Tokens = { accessToken?: string; expiresIn?: number; sessionToken?: string; refreshToken?: string; idToken?: string; clientId?: string; profile?: { id: string; name: string; email: string; locale: string; }; }; export type LoginOptions = { redirectUrl: string; action?: 'register' | 'login'; }; export declare enum AuthenticationFlow { CLIENT_CREDENTIALS = "client-credentials", AUTHORIZATION_CODE = "authorization-code" } export interface Authentication { getTokens(): Promise<Tokens | undefined>; getAccessToken(): Promise<string | undefined>; login(options?: LoginOptions): Promise<Tokens | undefined>; getLoginUrl(options?: LoginOptions): Promise<string | undefined>; renew(): Promise<void>; logout(): Promise<void>; }