Constructor
new AuthClass(config)
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | Configuration of the Auth |
- Source:
Methods
configure(config) → {Object}
Configure Auth part with aws configurations
Parameters:
Name | Type | Description |
---|---|---|
config |
Object | Configuration of the Auth |
- Source:
Returns:
- Current configuration
- Type
- Object
confirmSignIn(user, code) → {Promise}
Send MFA code to confirm sign in
Parameters:
Name | Type | Description |
---|---|---|
user |
Object | The CognitoUser object |
code |
String | The confirmation code |
- Source:
Returns:
- A promise resolves to CognitoUser if success
- Type
- Promise
confirmSignUp(username, code) → {Promise}
Send the verification code to confirm sign up
Parameters:
Name | Type | Description |
---|---|---|
username |
String | The username to be confirmed |
code |
String | The verification code |
- Source:
Returns:
- A promise resolves callback data if success
- Type
- Promise
currentAuthenticatedUser() → {Promise}
Get current authenticated user
- Source:
Returns:
- A promise resolves to curret authenticated CognitoUser if success
- Type
- Promise
currentCredentials() → {Promise}
Get current user credentials or guest credentials depend on sign in status.
- Source:
Returns:
- A promise resolves to be the current credentials
- Type
- Promise
currentSession()
Get current user's session
- Source:
Returns:
- A promise resolves to session object if success
currentUser() → {Promise}
Get current CognitoUser
- Source:
Returns:
- A promise resolves to curret CognitoUser if success
- Type
- Promise
currentUserCredentials() → {Promise}
Get authenticated credentials of current user.
- Source:
Returns:
- A promise resolves to be current user's credentials
- Type
- Promise
(async) currentUserInfo() → {Object}
Get user information
- Source:
Returns:
- current User's information
- Type
- Object
currentUserSession() → {Promise}
Get current user's session
- Source:
Returns:
- A promise resolves to session object if success
- Type
- Promise
essentialCredentials(credentials) → {Object}
Compact version of credentials
Parameters:
Name | Type | Description |
---|---|---|
credentials |
Object |
- Source:
Returns:
- Credentials
- Type
- Object
forgotPassword(username) → {Promise}
Initiate a forgot password request
Parameters:
Name | Type | Description |
---|---|---|
username |
String | the username to change password |
- Source:
Returns:
- A promise resolves if success
- Type
- Promise
forgotPasswordSubmit(username, code, password) → {Promise}
Confirm a new password using a confirmation Code
Parameters:
Name | Type | Description |
---|---|---|
username |
String | The username |
code |
String | The confirmation code |
password |
String | The new password |
- Source:
Returns:
- A promise that resolves if success
- Type
- Promise
guestCredentials() → {Promise}
Get unauthenticated credentials
- Source:
Returns:
- A promise resolves to be a guest credentials
- Type
- Promise
noSessionCredentials() → {Object}
- Source:
Returns:
- A new guest CognitoIdentityCredentials
- Type
- Object
resendSignUp(username) → {Promise}
Resend the verification code
Parameters:
Name | Type | Description |
---|---|---|
username |
String | The username to be confirmed |
- Source:
Returns:
- A promise resolves data if success
- Type
- Promise
sessionToCredentials(session) → {Object}
Produce a credentials based on the session
Parameters:
Name | Type | Description |
---|---|---|
session |
Object | The session used to generate the credentials |
- Source:
Returns:
- A new CognitoIdentityCredentials
- Type
- Object
signIn(username, password) → {Promise}
Sign in
Parameters:
Name | Type | Description |
---|---|---|
username |
String | The username to be signed in |
password |
String | The password of the username |
- Source:
Returns:
- A promise resolves the CognitoUser object if success or mfa required
- Type
- Promise
signOut() → {Promise}
Sign out method
- Source:
Returns:
- A promise resolved if success
- Type
- Promise
signUp(username, password, email, phone_number) → {Promise}
Sign up with username, password and other attrbutes like phone, email
Parameters:
Name | Type | Description |
---|---|---|
username |
String | The username to be signed up |
password |
String | The password of the user |
email |
String | The email of the user |
phone_number |
String | the phone number of the user |
- Source:
Returns:
- A promise resolves callback data if success
- Type
- Promise
userAttributes(user) → {Promise}
Return user attributes
Parameters:
Name | Type | Description |
---|---|---|
user |
Object | The CognitoUser object |
- Source:
Returns:
- A promise resolves to user attributes if success
- Type
- Promise
userSession(user) → {Promise}
Get the corresponding user session
Parameters:
Name | Type | Description |
---|---|---|
user |
Object | The CognitoUser object |
- Source:
Returns:
- A promise resolves to the session
- Type
- Promise
verifyCurrentUserAttribute(attr) → {Promise}
Initiate an attribute confirmation request for the current user
Parameters:
Name | Type | Description |
---|---|---|
attr |
String | The attributes to be verified |
- Source:
Returns:
- A promise resolves to callback data if success
- Type
- Promise
verifyCurrentUserAttributeSubmit(attr, code) → {Promise}
Confirm current user's attribute using a confirmation code
Parameters:
Name | Type | Description |
---|---|---|
attr |
String | The attribute to be verified |
code |
String | The confirmation code |
- Source:
Returns:
- A promise resolves to callback data if success
- Type
- Promise
verifyUserAttribute(user, attr) → {Promise}
Initiate an attribute confirmation request
Parameters:
Name | Type | Description |
---|---|---|
user |
Object | The CognitoUser |
attr |
Object | The attributes to be verified |
- Source:
Returns:
- A promise resolves to callback data if success
- Type
- Promise
verifyUserAttributeSubmit(user, attr, code) → {Promise}
Confirm an attribute using a confirmation code
Parameters:
Name | Type | Description |
---|---|---|
user |
Object | The CognitoUser |
attr |
Object | The attribute to be verified |
code |
String | The confirmation code |
- Source:
Returns:
- A promise resolves to callback data if success
- Type
- Promise