CognitoUser class

Constructors

CognitoUser(String? username, CognitoUserPool pool, {dynamic clientSecret, CognitoStorage? storage, String? deviceName = 'Dart-device', dynamic signInUserSession, ParamsDecorator? analyticsMetadataParamsDecorator})

Properties

authenticationFlowType String?
getter/setter pair
client Client?
getter/setter pair
deviceName String?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
keyPrefix String
no setter
pool CognitoUserPool
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
storage CognitoStorage
getter/setter pair
username String?
getter/setter pair
verifierDevices String?
getter/setter pair

Methods

associateSoftwareToken() Future<String?>
This is used by an authenticated user trying to authenticate to associate a TOTP MFA
authenticateUser(AuthenticationDetails authDetails) Future<CognitoUserSession?>
This is used for authenticating the user.
cacheDeviceKeyAndPassword() Future<void>
This is used to cache the device key and device group and device password
cacheTokens() Future<void>
This is used to save the session tokens to local storage
changePassword(String oldUserPassword, String newUserPassword) Future<bool>
This is used by an authenticated user to change the current password
clearCachedDeviceKeyAndPassword() Future<void>
This is used to clear the device key info from local storage
clearCachedTokens() Future<void>
This is used to clear the session tokens from local storage
confirmPassword(String confirmationCode, String newPassword) Future<bool>
This is used to confirm a new password using a confirmation code
confirmRegistration(String confirmationCode, {bool forceAliasCreation = false, Map<String, String>? clientMetadata}) Future<bool>
This is used for a certain user to confirm the registration by using a confirmation code
deleteAttributes(List<String> attributeList) Future<bool>
This is used by an authenticated user to delete a list of attributes
deleteUser() Future<bool>
This is used by an authenticated user to delete him/herself
disableMfa() Future<bool>
This is used by an authenticated user to disable MFA for him/herself
enableMfa() Future<bool>
This is used by authenticated users to enable SMS-MFA for him/herself. A verified phone number is required.
forgotPassword() Future
This is used to initiate a forgot password request
getAttributeVerificationCode(String attributeName) Future
This is used to initiate an attribute confirmation request
getAuthenticationFlowType() String?
getCachedDeviceKeyAndPassword() Future<void>
getCognitoUserSession(Map<String, dynamic> authResult) CognitoUserSession
This is used to build a user session from tokens retrieved in the authentication result
getDeviceKey() Future<String?>
Returns the cached key for this device. Device keys are stored in local storage and are used to track devices. Returns null if no device key was cached.
getDeviceResponse() Future<CognitoUserSession?>
This is used to get a session using device authentication. It is called at the end of user authentication
getMFAOptions() Future<List?>
This is used by an authenticated user to get the MFAOptions
getPreferredMFA() Future<String?>
This is used by an authenticated user to get the preferred MFA method
getSession() Future<CognitoUserSession?>
This is used to get a session, either from the session object or from the local storage, or by using a refresh token
getSignInUserSession() CognitoUserSession?
getUserAttributes() Future<List<CognitoUserAttribute>?>
This is used by authenticated users to get a list of attributes
getUserContextData() String?
This returns the user context data for advanced security feature.
getUserMFASettingList() Future<String?>
This is used by an authenticated user to get the available MFA methods
getUsername() String?
globalSignOut() Future<void>
This is used to globally revoke all tokens issued to a user
initiateAuth(AuthenticationDetails authDetails) Future<CognitoUserSession?>
This is used for authenticating the user through the custom authentication flow.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshSession(CognitoRefreshToken refreshToken) Future<CognitoUserSession?>
This uses the refreshToken to retrieve a new session
resendConfirmationCode() → dynamic
This is used by a user to resend a confirmation code
sendCustomChallengeAnswer(String answerChallenge, [Map<String, String>? validationData]) Future<CognitoUserSession?>
This is used by the user once he has the responses to a custom challenge
sendMFACode(String confirmationCode, [String mfaType = 'SMS_MFA']) Future<CognitoUserSession?>
This is used by the user once he has an MFA code
sendNewPasswordRequiredAnswer(String newPassword, [Map<String, String>? requiredAttributes]) Future<CognitoUserSession?>
This is used by the user once he has the responses to the NEW_PASSWORD_REQUIRED challenge.
setAuthenticationFlowType(String authenticationFlowType) → void
sets authentication flow type
setPreferredMFA(String mfaMethod) Future<bool>
Set prefered MFA Method which can be one of the following 'SOFTWARE_TOKEN_MFA' | 'SMS_MFA' | 'NOMFA'
setUserMfaPreference(IMfaSettings? smsMfaSettings, IMfaSettings? softwareTokenMfaSettings) Future<bool>
This is used by an authenticated user to enable MFA for itself
signOut({bool revokeRefreshToken = false}) Future<void>
This is used for the user to signOut of the application and clear the cached tokens. If revokeRefreshToken is set to true, it will revoke the refresh token.
toString() String
A string representation of this object.
inherited
updateAttributes(List<CognitoUserAttribute> attributes) Future<bool>
This is used by authenticated users to change a list of attributes If phone_number is changed it needs to be verified to be able to use it for MFA.
verifyAttribute(dynamic attributeName, dynamic confirmationCode) Future<bool>
This is used to confirm an attribute using a confirmation code
verifySoftwareToken({required String totpCode, String? friendlyDeviceName}) Future<bool>
This is used by an authenticated user trying to authenticate to verify a TOTP MFA

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

calculateClientSecretHash(String userName, String clientId, String clientSecret) String
Translated from library aws-android-sdk-cognitoprovider@2.6.30 file CognitoSecretHash.java::getSecretHash()