AWS Amplify API
AWS Amplify Home
Options
All

- Public
- Public/Protected
- All

Inherited Externals Only exported
Menu

Provide authentication steps

### Hierarchy

- AuthClass

## Index

### Constructors

- constructor

### Properties

- data

### Methods

- changePassword
- completeNewPassword
- configure
- confirmSignIn
- confirmSignUp
- currentAuthenticatedUser
- currentCredentials
- currentSession
- currentUserCredentials
- currentUserInfo
- currentUserPoolUser
- disableSMS
- enableSMS
- essentialCredentials
- federatedSignIn
- forgotPassword
- forgotPasswordSubmit
- getMFAOptions
- getModuleName
- getPreferredMFA
- resendSignUp
- sendCustomChallengeAnswer
- setPreferredMFA
- setupTOTP
- signIn
- signOut
- signUp
- updateUserAttributes
- userAttributes
- userSession
- verifiedContact
- verifyCurrentUserAttribute
- verifyCurrentUserAttributeSubmit
- verifyTotpToken
- verifyUserAttribute
- verifyUserAttributeSubmit

## Constructors

### constructor

- new AuthClass(config: AuthOptions): AuthClass

- - Defined in auth/src/Auth.ts:94

  Initialize Auth with AWS configurations

  #### Parameters

  - ##### config: AuthOptions

    Configuration of the Auth

  #### Returns AuthClass

## Properties

### data

data: any

- Defined in aws-amplify-angular/src/components/authenticator/authenticator/authenticator.class.ts:17

## Methods

### changePassword

- changePassword(user: CognitoUser | any, oldPassword: string, newPassword: string): Promise<"SUCCESS">

- - Defined in auth/src/Auth.ts:1317

  Change a password for an authenticated user

  #### Parameters

  - ##### user: CognitoUser | any

    The CognitoUser object

  - ##### oldPassword: string

    the current password

  - ##### newPassword: string

    the requested new password

  #### Returns Promise<"SUCCESS">

  - A promise resolves if success

### completeNewPassword

- completeNewPassword(user: CognitoUser | any, password: string, requiredAttributes: any): Promise<CognitoUser | any>

- - Defined in auth/src/Auth.ts:815

  #### Parameters

  - ##### user: CognitoUser | any

  - ##### password: string

  - ##### requiredAttributes: any

  #### Returns Promise<CognitoUser | any>

### configure

- configure(config: any): any

- - Defined in auth/src/Auth.ts:131

  #### Parameters

  - ##### config: any

  #### Returns any

### confirmSignIn

- confirmSignIn(user: CognitoUser | any, code: string, mfaType?: "SMS_MFA" | "SOFTWARE_TOKEN_MFA" | null): Promise<CognitoUser | any>

- - Defined in auth/src/Auth.ts:776

  Send MFA code to confirm sign in

  #### Parameters

  - ##### user: CognitoUser | any

    The CognitoUser object

  - ##### code: string

    The confirmation code

  - ##### Optional mfaType: "SMS_MFA" | "SOFTWARE_TOKEN_MFA" | null

  #### Returns Promise<CognitoUser | any>

### confirmSignUp

- confirmSignUp(username: string, code: string, options?: ConfirmSignUpOptions): Promise<any>

- - Defined in auth/src/Auth.ts:298

  Send the verfication code to confirm sign up

  #### Parameters

  - ##### username: string

    The username to be confirmed

  - ##### code: string

    The verification code

  - ##### Optional options: ConfirmSignUpOptions

    other options for confirm signup

  #### Returns Promise<any>

  - A promise resolves callback data if success

### currentAuthenticatedUser

- currentAuthenticatedUser(params?: CurrentUserOpts): Promise<CognitoUser | any>

- - Defined in auth/src/Auth.ts:1030

  Get current authenticated user

  #### Parameters

  - ##### Optional params: CurrentUserOpts

  #### Returns Promise<CognitoUser | any>

  - A promise resolves to current authenticated CognitoUser if success

### currentCredentials

- currentCredentials(): Promise<ICredentials>

- - Defined in auth/src/Auth.ts:1160

  #### Returns Promise<ICredentials>

### currentSession

- currentSession(): Promise<CognitoUserSession>

- - Defined in auth/src/Auth.ts:1072

  Get current user's session

  #### Returns Promise<CognitoUserSession>

  - A promise resolves to session object if success

### currentUserCredentials

- currentUserCredentials(): Promise<ICredentials>

- - Defined in auth/src/Auth.ts:1125

  Get authenticated credentials of current user.

  #### Returns Promise<ICredentials>

  - A promise resolves to be current user's credentials

### currentUserInfo

- currentUserInfo(): Promise<any>

- - Defined in auth/src/Auth.ts:1398

  Get user information

  async

  #### Returns Promise<any>

  - current User's information

### currentUserPoolUser

- currentUserPoolUser(params?: CurrentUserOpts): Promise<CognitoUser | any>

- - Defined in auth/src/Auth.ts:955

  Get current authenticated user

  #### Parameters

  - ##### Optional params: CurrentUserOpts

  #### Returns Promise<CognitoUser | any>

  - A promise resolves to current authenticated CognitoUser if success

### disableSMS

- disableSMS(user: CognitoUser): Promise<string>

- - Defined in auth/src/Auth.ts:689

  diable SMS

  deprecated

  #### Parameters

  - ##### user: CognitoUser

    the current user

  #### Returns Promise<string>

  - A promise resolves is success

### enableSMS

- enableSMS(user: CognitoUser): Promise<string>

- - Defined in auth/src/Auth.ts:710

  enable SMS

  deprecated

  #### Parameters

  - ##### user: CognitoUser

    the current user

  #### Returns Promise<string>

  - A promise resolves is success

### essentialCredentials

- essentialCredentials(credentials: any): ICredentials

- - Defined in auth/src/Auth.ts:1605

  Compact version of credentials

  #### Parameters

  - ##### credentials: any

  #### Returns ICredentials

  - Credentials

### federatedSignIn

- federatedSignIn(options?: FederatedSignInOptions): Promise<ICredentials>
- federatedSignIn(provider: LegacyProvider, response: FederatedResponse, user: FederatedUser): Promise<ICredentials>
- federatedSignIn(options?: FederatedSignInOptionsCustom): Promise<ICredentials>

- - Defined in auth/src/Auth.ts:1436

  #### Parameters

  - ##### Optional options: FederatedSignInOptions

  #### Returns Promise<ICredentials>

- - Defined in auth/src/Auth.ts:1438

  #### Parameters

  - ##### provider: LegacyProvider

  - ##### response: FederatedResponse

  - ##### user: FederatedUser

  #### Returns Promise<ICredentials>

- - Defined in auth/src/Auth.ts:1443

  #### Parameters

  - ##### Optional options: FederatedSignInOptionsCustom

  #### Returns Promise<ICredentials>

### forgotPassword

- forgotPassword(username: string): Promise<any>

- - Defined in auth/src/Auth.ts:1337

  Initiate a forgot password request

  #### Parameters

  - ##### username: string

    the username to change password

  #### Returns Promise<any>

  - A promise resolves if success

### forgotPasswordSubmit

- forgotPasswordSubmit(username: string, code: string, password: string): Promise<void>

- - Defined in auth/src/Auth.ts:1368

  Confirm a new password using a confirmation Code

  #### Parameters

  - ##### username: string

    The username

  - ##### code: string

    The confirmation code

  - ##### password: string

    The new password

  #### Returns Promise<void>

  - A promise that resolves if success

### getMFAOptions

- getMFAOptions(user: CognitoUser | any): Promise<MFAOption[]>

- - Defined in auth/src/Auth.ts:497

  get user current preferred mfa option this method doesn't work with totp, we need to deprecate it.

  deprecated

  #### Parameters

  - ##### user: CognitoUser | any

    the current user

  #### Returns Promise<MFAOption[]>

  - A promise resolves the current preferred mfa option if success

### getModuleName

- getModuleName(): string

- - Defined in auth/src/Auth.ts:127

  #### Returns string

### getPreferredMFA

- getPreferredMFA(user: CognitoUser | any, params?: GetPreferredMFAOpts): Promise<string>

- - Defined in auth/src/Auth.ts:517

  get preferred mfa method

  #### Parameters

  - ##### user: CognitoUser | any

    the current cognito user

  - ##### Optional params: GetPreferredMFAOpts

    options for getting the current user preferred MFA

  #### Returns Promise<string>

### resendSignUp

- resendSignUp(username: string): Promise<string>

- - Defined in auth/src/Auth.ts:319

  Resend the verification code

  #### Parameters

  - ##### username: string

    The username to be confirmed

  #### Returns Promise<string>

  - A promise resolves data if success

### sendCustomChallengeAnswer

- sendCustomChallengeAnswer(user: CognitoUser | any, challengeResponses: string): Promise<CognitoUser | any>

- - Defined in auth/src/Auth.ts:872

  Send the answer to a custom challenge

  #### Parameters

  - ##### user: CognitoUser | any

    The CognitoUser object

  - ##### challengeResponses: string

    The confirmation code

  #### Returns Promise<CognitoUser | any>

### setPreferredMFA

- setPreferredMFA(user: CognitoUser | any, mfaMethod: "TOTP" | "SMS" | "NOMFA"): Promise<string>

- - Defined in auth/src/Auth.ts:598

  set preferred MFA method

  #### Parameters

  - ##### user: CognitoUser | any

    the current Cognito user

  - ##### mfaMethod: "TOTP" | "SMS" | "NOMFA"

    preferred mfa method

  #### Returns Promise<string>

  - A promise resolve if success

### setupTOTP

- setupTOTP(user: CognitoUser | any): Promise<string>

- - Defined in auth/src/Auth.ts:730

  Setup TOTP

  #### Parameters

  - ##### user: CognitoUser | any

    the current user

  #### Returns Promise<string>

  - A promise resolves with the secret code if success

### signIn

- signIn(usernameOrSignInOpts: string | SignInOpts, pw?: string): Promise<CognitoUser | any>

- - Defined in auth/src/Auth.ts:337

  Sign in

  #### Parameters

  - ##### usernameOrSignInOpts: string | SignInOpts

    The username to be signed in or the sign in options

  - ##### Optional pw: string

  #### Returns Promise<CognitoUser | any>

  - A promise resolves the CognitoUser

### signOut

- signOut(opts?: SignOutOpts): Promise<any>

- - Defined in auth/src/Auth.ts:1273

  Sign out method @

  #### Parameters

  - ##### Optional opts: SignOutOpts

  #### Returns Promise<any>

  - A promise resolved if success

### signUp

- signUp(params: string | SignUpParams, ...restOfAttrs: string[]): Promise<ISignUpResult>

- - Defined in auth/src/Auth.ts:234

  Sign up with username, password and other attrbutes like phone, email

  #### Parameters

  - ##### params: string | SignUpParams

    The user attirbutes used for signin

  - ##### Rest ...restOfAttrs: string[]

    for the backward compatability

  #### Returns Promise<ISignUpResult>

  - A promise resolves callback data if success

### updateUserAttributes

- updateUserAttributes(user: CognitoUser | any, attributes: object): Promise<string>

- - Defined in auth/src/Auth.ts:887

  Update an authenticated users' attributes

  #### Parameters

  - ##### user: CognitoUser | any

  - ##### attributes: object

  #### Returns Promise<string>

### userAttributes

- userAttributes(user: CognitoUser | any): Promise<CognitoUserAttribute[]>

- - Defined in auth/src/Auth.ts:913

  Return user attributes

  #### Parameters

  - ##### user: CognitoUser | any

    The CognitoUser object

  #### Returns Promise<CognitoUserAttribute[]>

  - A promise resolves to user attributes if success

### userSession

- userSession(user: any): Promise<CognitoUserSession>

- - Defined in auth/src/Auth.ts:1100

  Get the corresponding user session

  #### Parameters

  - ##### user: any

    The CognitoUser object

  #### Returns Promise<CognitoUserSession>

  - A promise resolves to the session

### verifiedContact

- verifiedContact(user: CognitoUser | any): Promise<object>

- - Defined in auth/src/Auth.ts:923

  #### Parameters

  - ##### user: CognitoUser | any

  #### Returns Promise<object>

### verifyCurrentUserAttribute

- verifyCurrentUserAttribute(attr: string): Promise<void>

- - Defined in auth/src/Auth.ts:1204

  #### Parameters

  - ##### attr: string

  #### Returns Promise<void>

### verifyCurrentUserAttributeSubmit

- verifyCurrentUserAttributeSubmit(attr: string, code: string): Promise<string>

- - Defined in auth/src/Auth.ts:1216

  Confirm current user's attribute using a confirmation code

  #### Parameters

  - ##### attr: string

    The attribute to be verified

  - ##### code: string

    The confirmation code

  #### Returns Promise<string>

  - A promise resolves to callback data if success

### verifyTotpToken

- verifyTotpToken(user: CognitoUser | any, challengeAnswer: string): Promise<CognitoUserSession>

- - Defined in auth/src/Auth.ts:753

  verify TOTP setup

  #### Parameters

  - ##### user: CognitoUser | any

    the current user

  - ##### challengeAnswer: string

    challenge answer

  #### Returns Promise<CognitoUserSession>

  - A promise resolves is success

### verifyUserAttribute

- verifyUserAttribute(user: CognitoUser | any, attr: string): Promise<void>

- - Defined in auth/src/Auth.ts:1171

  Initiate an attribute confirmation request

  #### Parameters

  - ##### user: CognitoUser | any

    The CognitoUser

  - ##### attr: string

    The attributes to be verified

  #### Returns Promise<void>

  - A promise resolves to callback data if success

### verifyUserAttributeSubmit

- verifyUserAttributeSubmit(user: CognitoUser | any, attr: string, code: string): Promise<string>

- - Defined in auth/src/Auth.ts:1187

  Confirm an attribute using a confirmation code

  #### Parameters

  - ##### user: CognitoUser | any

    The CognitoUser

  - ##### attr: string

    The attribute to be verified

  - ##### code: string

    The confirmation code

  #### Returns Promise<string>

  - A promise resolves to callback data if success