UNPKG

@livechat/customer-auth

Version:

Authorization library for connecting to LiveChat as a customer.

54 lines 1.47 kB
export type Config = { organizationId: string; clientId: string; groupId?: number; uniqueGroups: boolean; redirectUri?: string; tokenStoragePrefix?: string; }; export type Env = 'labs' | 'staging' | 'production'; export type Token = { accessToken: string; creationDate: number; entityId: string; expiresIn: number; organizationId: string; tokenType: 'Bearer'; }; type IdentityException = { client_id: string; flow: 'button'; identity_exception: 'unauthorized'; organization_id: number; post_message_uri: string; redirect_uri: string; response_type: 'token'; scope: 'all'; }; type OauthException = { client_id: string; client_type: 'javascript_app'; flow: 'button'; organization_id: string; oauth_exception: 'access_denied'; post_message_uri: string; redirect_uri: string; response_type: 'token'; }; export type TokenError = IdentityException | OauthException; export type TokenResponse = { access_token: string; entity_id: string; expires_in: number; redirect_uri: string; token_type: 'Bearer'; }; export type RegisterNativeRequest = (uri: string, callback: (token: TokenResponse | TokenError) => void) => void; export type CustomerAuth = { getFreshToken: () => Promise<Token>; getToken: () => Promise<Token>; hasToken: () => Promise<boolean>; invalidate: () => Promise<void>; }; export {}; //# sourceMappingURL=types.d.ts.map