@aws-amplify/auth
Version:
Auth category of aws-amplify
111 lines (110 loc) • 3.06 kB
TypeScript
import { ICookieStorageData, ICognitoStorage, CognitoUserAttribute } from "amazon-cognito-identity-js";
/**
* Parameters for user sign up
*/
export interface SignUpParams {
username: string;
password: string;
attributes?: object;
validationData?: CognitoUserAttribute[];
}
export interface AuthCache {
setItem(): any;
getItem(): any;
removeItem(): any;
}
/**
* Auth instance options
*/
export interface AuthOptions {
userPoolId?: string;
userPoolWebClientId?: string;
identityPoolId?: string;
region?: string;
mandatorySignIn?: boolean;
cookieStorage?: ICookieStorageData;
oauth?: OAuthOpts;
refreshHandlers?: object;
storage?: ICognitoStorage;
authenticationFlowType?: string;
identityPoolRegion?: string;
}
export declare enum CognitoHostedUIIdentityProvider {
Cognito = "COGNITO",
Google = "Google",
Facebook = "Facebook",
Amazon = "LoginWithAmazon"
}
export declare type LegacyProvider = 'google' | 'facebook' | 'amazon' | 'developer' | string;
export declare type FederatedSignInOptions = {
provider: CognitoHostedUIIdentityProvider;
};
export declare type FederatedSignInOptionsCustom = {
customProvider: string;
};
export declare function isFederatedSignInOptions(obj: any): obj is FederatedSignInOptions;
export declare function isFederatedSignInOptionsCustom(obj: any): obj is FederatedSignInOptionsCustom;
/**
* Details for multi-factor authentication
*/
export interface MfaRequiredDetails {
challengeName: any;
challengeParameters: any;
}
/**
* interface for federatedResponse
*/
export interface FederatedResponse {
token: string;
identity_id?: string;
expires_at: number;
}
/**
* interface for federatedUser
*/
export interface FederatedUser {
name: string;
email?: string;
}
export interface AwsCognitoOAuthOpts {
domain: string;
scope: Array<string>;
redirectSignIn: string;
redirectSignOut: string;
responseType: string;
options?: object;
urlOpener?: (url: string, redirectUrl: string) => Promise<any>;
}
export declare function isCognitoHostedOpts(oauth: OAuthOpts): oauth is AwsCognitoOAuthOpts;
export interface Auth0OAuthOpts {
domain: string;
clientID: string;
scope: string;
redirectUri: string;
audience: string;
responseType: string;
returnTo: string;
urlOpener?: (url: string, redirectUrl: string) => Promise<any>;
}
export declare type OAuthOpts = AwsCognitoOAuthOpts | Auth0OAuthOpts;
export interface ConfirmSignUpOptions {
forceAliasCreation?: boolean;
}
export interface SignOutOpts {
global?: boolean;
}
export interface CurrentUserOpts {
bypassCache: boolean;
}
export interface GetPreferredMFAOpts {
bypassCache: boolean;
}
export declare type UsernamePasswordOpts = {
username: string;
password: string;
validationData?: {
[key: string]: any;
};
};
export declare type SignInOpts = UsernamePasswordOpts;
export declare function isUsernamePasswordOpts(obj: any): obj is UsernamePasswordOpts;