Options
All
  • Public
  • Public/Protected
  • All
Menu

Provide authentication steps

Hierarchy

  • AuthClass

Index

Constructors

constructor

Properties

Credentials

Credentials: CredentialsClass = Credentials

Methods

changePassword

  • changePassword(user: CognitoUser | any, oldPassword: string, newPassword: string, clientMetadata?: ClientMetaData): Promise<"SUCCESS">
  • 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

    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

    Returns Promise<"SUCCESS">

    • A promise resolves if success

completeNewPassword

  • completeNewPassword(user: CognitoUser | any, password: string, requiredAttributes?: any, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>

configure

confirmSignIn

  • confirmSignIn(user: CognitoUser | any, code: string, mfaType?: "SMS_MFA" | "SOFTWARE_TOKEN_MFA" | null, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>
  • 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
    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

    Returns Promise<CognitoUser | any>

confirmSignUp

  • Send the verification 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

currentCredentials

  • currentCredentials(): Promise<ICredentials>

currentSession

  • currentSession(): Promise<CognitoUserSession>

currentUserCredentials

  • currentUserCredentials(): Promise<ICredentials>

currentUserInfo

currentUserPoolUser

deleteUser

  • deleteUser(): Promise<string | void>

deleteUserAttributes

  • deleteUserAttributes(user: CognitoUser | any, attributeNames: string[]): Promise<unknown>

disableSMS

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

enableSMS

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

essentialCredentials

  • essentialCredentials(credentials: any): ICredentials

federatedSignIn

fetchDevices

forgetDevice

forgotPassword

  • Initiate a forgot password request

    Parameters

    • username: string

      the username to change password

    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

    Returns Promise<any>

    • A promise resolves if success

forgotPasswordSubmit

  • forgotPasswordSubmit(username: string, code: string, password: string, clientMetadata?: ClientMetaData): Promise<string>
  • Confirm a new password using a confirmation Code

    Parameters

    • username: string

      The username

    • code: string

      The confirmation code

    • password: string

      The new password

    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

    Returns Promise<string>

    • A promise that resolves if success

getMFAOptions

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

getModuleName

  • getModuleName(): string

getPreferredMFA

rememberDevice

resendSignUp

  • Resend the verification code

    Parameters

    • username: string

      The username to be confirmed

    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

      Metadata to be passed to Cognito Lambda triggers

    Returns Promise<any>

    • A promise resolves code delivery details if successful

sendCustomChallengeAnswer

  • sendCustomChallengeAnswer(user: CognitoUser | any, challengeResponses: string, clientMetadata?: ClientMetaData): Promise<CognitoUser | any>
  • Send the answer to a custom challenge

    Parameters

    • user: CognitoUser | any

      The CognitoUser object

    • challengeResponses: string

      The confirmation code

    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

    Returns Promise<CognitoUser | any>

setPreferredMFA

  • setPreferredMFA(user: CognitoUser | any, mfaMethod: "TOTP" | "SMS" | "NOMFA" | "SMS_MFA" | "SOFTWARE_TOKEN_MFA"): Promise<string>
  • set preferred MFA method

    Parameters

    • user: CognitoUser | any

      the current Cognito user

    • mfaMethod: "TOTP" | "SMS" | "NOMFA" | "SMS_MFA" | "SOFTWARE_TOKEN_MFA"

      preferred mfa method

    Returns Promise<string>

    • A promise resolve if success

setupTOTP

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

signIn

  • Sign in

    Parameters

    • usernameOrSignInOpts: string | SignInOpts

      The username to be signed in or the sign in options

    • Optional pw: string

      The password of the username

    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

      Client metadata for custom workflows

    Returns Promise<CognitoUser | any>

    • A promise resolves the CognitoUser

signOut

signUp

  • Sign up with username, password and other attributes like phone, email

    Parameters

    • params: string | SignUpParams

      The user attributes 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, clientMetadata?: ClientMetaData): Promise<string>

userAttributes

  • userAttributes(user: CognitoUser | any): Promise<CognitoUserAttribute[]>
  • 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>
  • 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>

verifyCurrentUserAttribute

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

verifyCurrentUserAttributeSubmit

  • verifyCurrentUserAttributeSubmit(attr: string, code: string): Promise<string>
  • 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>
  • 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, clientMetadata?: ClientMetaData): Promise<void>
  • Initiate an attribute confirmation request

    Parameters

    • user: CognitoUser | any

      The CognitoUser

    • attr: string

      The attributes to be verified

    • Default value clientMetadata: ClientMetaData = this._config.clientMetadata

    Returns Promise<void>

    • A promise resolves to callback data if success

verifyUserAttributeSubmit

  • verifyUserAttributeSubmit(user: CognitoUser | any, attr: string, code: string): Promise<string>
  • 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

wrapRefreshSessionCallback

  • wrapRefreshSessionCallback(callback: NodeCallback.Any): function
  • Parameters

    • callback: NodeCallback.Any

    Returns function

      • (err?: E, result?: T): void
      • Parameters

        • Optional err: E
        • Optional result: T

        Returns void