UNPKG

980 BTypeScriptView Raw
1import { OAuthOpts, CognitoHostedUIIdentityProvider } from '../types/Auth';
2export default class OAuth {
3 private _urlOpener;
4 private _config;
5 private _cognitoClientId;
6 private _scopes;
7 constructor({ config, cognitoClientId, scopes, }: {
8 scopes: string[];
9 config: OAuthOpts;
10 cognitoClientId: string;
11 });
12 private isValidScopes;
13 oauthSignIn(responseType: string, domain: string, redirectSignIn: string, clientId: string, provider?: CognitoHostedUIIdentityProvider | string, customState?: string): void;
14 private _handleCodeFlow;
15 private _handleImplicitFlow;
16 handleAuthResponse(currentUrl?: string): Promise<{
17 state: string;
18 accessToken: any;
19 refreshToken: any;
20 idToken: any;
21 }>;
22 private _validateState;
23 signOut(): Promise<any>;
24 private _generateState;
25 private _generateChallenge;
26 private _base64URL;
27 private _generateRandom;
28 private _bufferToString;
29}