Function
Static Public Summary | ||
public |
Authenticates with a user pool, and handles responses. |
|
public |
buildLogins(username: string, jwtToken: string, config: object): * builds the federated identity pool login structure |
|
public |
changePassword(user: object, oldPassword: string, newPassword: string) Change a user's password |
|
public |
reducer function to be passed to redux combineReducers |
|
public |
createGuard(store: object, forbiddenUrl: string): function creates a guard function you can use in <Route> tags |
|
public |
transitions directly from AUTHENTICATED to LOGGING_IN |
|
public |
emailVerificationFlow(user: object, attributes: object): Promise<object> sends the email verification code and transitions to the correct state |
|
public |
emailVerificationRequired(state: object, dispatch: function) requires email verification before transitioning from AUTHENTICATED |
|
public |
subscribes a "policy" function to the store, and calls it with the state and the dispatch function |
|
public |
fetchAttributes(state: object, dispatch: function) fetches and stores attributes before transitioning from AUTHENTICATED |
|
public |
getUserAttributes(user: object): Promise Fetches the user attributes from Cognito, and turns them into an object |
|
public |
identityPoolLogin(state: object, dispatch: function) logs into the single federated identity pool to transition from LOGGING_IN to LOGGED_IN |
|
public |
mkAttrList(attributes: object): array convert an attribute dictionary to an attribute list |
|
public |
performLogin(user: object, config: object): Promise<object> establishes a session with the user pool, and logs into the federated identity pool using a token from the session |
|
public |
registerUser(userPool: object, config: object, username: string, password: string, attributes: object): Promise<object> sign up this user with the user pool provided |
|
public |
sendAttributeVerificationCode(user: object, attribute: string) Request that a verification code is sent by email or SMS to verify an attribute |
|
public |
setupCognito(store: *, config: *) sets up react-cognito with default policies. |
|
public |
updateAttributes(user: object, attributes: object): Promise<object> update the attributes in Cognito |
Static Public
public authenticate(username: string, password: string, userPool: object): Promise<object> source
import {authenticate} from 'react-cognito/src/auth.js'
Authenticates with a user pool, and handles responses. if the authentication is successful it then logs in to the identity pool.
returns an action depending on the outcome. Possible actions returned are:
- login - valid user who is logged in
- loginFailure - failed to authenticate with user pool or identity pool
- mfaRequired - user now needs to enter MFA
- newPasswordRequired - user must change password on first login
- emailVerificationRequired - user must verify their email address
- emailVerificationFailed - email verification is required, but won't work
Dispatch the resulting action, e.g.:
const { userPool, config } = state.cognito;
authenticate(username, password, userPool, config).then(dispatch);
public buildLogins(username: string, jwtToken: string, config: object): * source
import {buildLogins} from 'react-cognito/src/utils.js'
builds the federated identity pool login structure
Return:
* |
public changePassword(user: object, oldPassword: string, newPassword: string) source
import {changePassword} from 'react-cognito/src/utils.js'
Change a user's password
public cognito(state: object, action: object): * source
import {cognito} from 'react-cognito/src/reducers.js'
reducer function to be passed to redux combineReducers
Return:
* |
public createGuard(store: object, forbiddenUrl: string): function source
import {createGuard} from 'react-cognito/src/guard.js'
creates a guard function you can use in <Route> tags
public direct(state: object, dispatch: function) source
import {direct} from 'react-cognito/src/policy.js'
transitions directly from AUTHENTICATED to LOGGING_IN
public emailVerificationFlow(user: object, attributes: object): Promise<object> source
import {emailVerificationFlow} from 'react-cognito/src/auth.js'
sends the email verification code and transitions to the correct state
public emailVerificationRequired(state: object, dispatch: function) source
import {emailVerificationRequired} from 'react-cognito/src/policy.js'
requires email verification before transitioning from AUTHENTICATED
public enable(store: object, f: function) source
import {enable} from 'react-cognito/src/policy.js'
subscribes a "policy" function to the store, and calls it with the state and the dispatch function
public fetchAttributes(state: object, dispatch: function) source
import {fetchAttributes} from 'react-cognito/src/policy.js'
fetches and stores attributes before transitioning from AUTHENTICATED
public getUserAttributes(user: object): Promise source
import {getUserAttributes} from 'react-cognito/src/attributes.js'
Fetches the user attributes from Cognito, and turns them into an object
Params:
Name | Type | Attribute | Description |
user | object | the cognito user object |
public identityPoolLogin(state: object, dispatch: function) source
import {identityPoolLogin} from 'react-cognito/src/policy.js'
logs into the single federated identity pool to transition from LOGGING_IN to LOGGED_IN
public mkAttrList(attributes: object): array source
import {mkAttrList} from 'react-cognito/src/attributes.js'
convert an attribute dictionary to an attribute list
Params:
Name | Type | Attribute | Description |
attributes | object | a dictionary of attributes |
Return:
array | AWS expected attribute list |
public performLogin(user: object, config: object): Promise<object> source
import {performLogin} from 'react-cognito/src/auth.js'
establishes a session with the user pool, and logs into the federated identity pool using a token from the session
public registerUser(userPool: object, config: object, username: string, password: string, attributes: object): Promise<object> source
import {registerUser} from 'react-cognito/src/auth.js'
sign up this user with the user pool provided
public sendAttributeVerificationCode(user: object, attribute: string) source
import {sendAttributeVerificationCode} from 'react-cognito/src/attributes.js'
Request that a verification code is sent by email or SMS to verify an attribute
public setupCognito(store: *, config: *) source
import {setupCognito} from 'react-cognito/src/policy.js'
sets up react-cognito with default policies.
Params:
Name | Type | Attribute | Description |
store | * | ||
config | * |