AWSCognitoIdentityUser
Objective-C
@interface AWSCognitoIdentityUser : NSObject
/**
The username of this user
*/
@property (nonatomic, readonly, nullable) NSString *username;
/**
If this user is a result of a signup, this has the confirmation status
*/
@property (nonatomic, readonly) AWSCognitoIdentityUserStatus confirmedStatus;
/**
Determines whether this user has an active session or not. If the refresh token is expired
the user will be prompted to authenticate when you call getSession.
*/
@property (nonatomic, readonly, getter=isSignedIn) BOOL signedIn;
/**
Determines whether this user's session is revocable. If the access token has "origin_jti" claim, then the revocation feature is enabled.
*/
@property (nonatomic, readonly, getter=isSessionRevocable) BOOL sessionRevocable;
/**
Get the device id
@warning This function is deprecated and will be removed in an upcoming minor
version of the SDK. You should use deviceIdentifier instead.
@deprecated Use deviceIdentifier instead.
*/
@property (nonatomic, readonly) NSString * deviceId DEPRECATED_MSG_ATTRIBUTE("Use deviceIdentifier instead.");
/**
Get the device id
*/
@property (nonatomic, readonly, nullable) NSString * deviceIdentifier;
/**
Confirm a users' sign up with the confirmation code
*/
- (AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *)confirmSignUp:(NSString *)confirmationCode;
/**
Confirm a users' sign up with the confirmation code. If forceAliasCreation is set, if another user is aliased to the same email/phone this code was sent to, reassign alias to this user.
*/
-(AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *) confirmSignUp:(NSString *) confirmationCode
forceAliasCreation:(BOOL)forceAliasCreation;
-(AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *) confirmSignUp:(NSString *) confirmationCode
clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
-(AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *) confirmSignUp:(NSString *) confirmationCode
forceAliasCreation:(BOOL)forceAliasCreation
clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
/**
Resend the confirmation code sent during sign up
*/
- (AWSTask<AWSCognitoIdentityUserResendConfirmationCodeResponse *> *)resendConfirmationCode: (nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
- (AWSTask<AWSCognitoIdentityUserResendConfirmationCodeResponse *> *)resendConfirmationCode;
/**
Get a session with id, access and refresh tokens.
*/
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession;
/**
Get a session with the following username and password
*/
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username
password:(NSString *)password
validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData;
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username
password:(NSString *)password
validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData
clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username
password:(NSString *)password
validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData
isInitialCustomChallenge:(BOOL)isInitialCustomChallenge;
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username
password:(NSString *)password
validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData
clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData
isInitialCustomChallenge:(BOOL)isInitialCustomChallenge;
/**
Get details about this user, including user attributes
*/
- (AWSTask<AWSCognitoIdentityUserGetDetailsResponse *> *)getDetails;
/**
Send a code to this user to initiate the forgot password flow
*/
- (AWSTask<AWSCognitoIdentityUserForgotPasswordResponse *> *)forgotPassword:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
- (AWSTask<AWSCognitoIdentityUserForgotPasswordResponse *> *)forgotPassword;
/**
Conclude the forgot password flow by providing the forgot password code and new password.
*/
- (AWSTask<AWSCognitoIdentityUserConfirmForgotPasswordResponse *> *)confirmForgotPassword:(NSString *)confirmationCode
password:(NSString *)password
clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
- (AWSTask<AWSCognitoIdentityUserConfirmForgotPasswordResponse *> *)confirmForgotPassword:(NSString *)confirmationCode
password:(NSString *)password;
/**
Change this user's password
*/
- (AWSTask<AWSCognitoIdentityUserChangePasswordResponse *> *)changePassword:(NSString *)currentPassword
proposedPassword:(NSString *)proposedPassword;
/**
Update this user's attributes
*/
- (AWSTask<AWSCognitoIdentityUserUpdateAttributesResponse *> *)updateAttributes:(NSArray<AWSCognitoIdentityUserAttributeType *> *)attributes
clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
- (AWSTask<AWSCognitoIdentityUserUpdateAttributesResponse *> *)updateAttributes:(NSArray<AWSCognitoIdentityUserAttributeType *> *)attributes;
/**
Delete the attributes specified by attributeNames
*/
- (AWSTask<AWSCognitoIdentityUserDeleteAttributesResponse *> *)deleteAttributes:(NSArray<NSString *> *)attributeNames;
/**
Verify a user attribute upon receiving the verification code.
*/
- (AWSTask<AWSCognitoIdentityUserVerifyAttributeResponse *> *)verifyAttribute:(NSString *)attributeName
code:(NSString *)code;
/**
Request a verification code to verify an attribute.
*/
- (AWSTask<AWSCognitoIdentityUserGetAttributeVerificationCodeResponse *> *)getAttributeVerificationCode:(NSString *)attributeName
clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
- (AWSTask<AWSCognitoIdentityUserGetAttributeVerificationCodeResponse *> *)getAttributeVerificationCode:(NSString *)attributeName;
/**
Set the user settings for this user such as MFA
*/
- (AWSTask<AWSCognitoIdentityUserSetUserSettingsResponse *> *)setUserSettings:(AWSCognitoIdentityUserSettings *)settings;
/**
Set the user mfa preference supercedes SetUserSettings
*/
- (AWSTask<AWSCognitoIdentityUserSetUserMfaPreferenceResponse *> *)setUserMfaPreference:(AWSCognitoIdentityUserMfaPreferences *) preferences;
/**
Start the process of associating a software token
*/
- (AWSTask<AWSCognitoIdentityUserAssociateSoftwareTokenResponse *> *) associateSoftwareToken;
/**
Complete the process of associating a software token by verifying the code and setting device friendly name
*/
-(AWSTask<AWSCognitoIdentityUserVerifySoftwareTokenResponse *>*) verifySoftwareToken: (NSString*) userCode friendlyDeviceName: (NSString* _Nullable) friendlyDeviceName;
/**
Delete this user
*/
- (AWSTask *)deleteUser;
/**
Remove all sessions from the keychain for this user. Last known user remains.
*/
- (void)signOut;
/**
Revoke all tokens for this user. Check Access Token for claims for validity to revoke tokens.
*/
- (AWSTask<AWSCognitoIdentityProviderRevokeTokenResponse *> *) revokeToken;
/**
Invalidate any active sessions with the service. Last known user remains.
*/
- (AWSTask<AWSCognitoIdentityUserGlobalSignOutResponse *> *) globalSignOut;
/**
Remove all sessions from the keychain for this user and clear last known user.
*/
- (void) signOutAndClearLastKnownUser;
/**
Remove the id and access token from the keychain, but keep the refresh token.
Use this when you have updated user attributes and want to refresh the id and access tokens.
*/
- (void) clearSession;
/**
List devices for this user
*/
- (AWSTask<AWSCognitoIdentityUserListDevicesResponse *> *) listDevices: (int) limit paginationToken:(NSString * _Nullable) paginationToken;
/**
Update device remembered status for a specific device id.
*/
- (AWSTask<AWSCognitoIdentityUserUpdateDeviceStatusResponse *> *) updateDeviceStatus: (NSString *) deviceId remembered:(BOOL) remembered;
/**
Convenience method to update device remembered status for this device.
*/
- (AWSTask<AWSCognitoIdentityUserUpdateDeviceStatusResponse *> *) updateDeviceStatus: (BOOL) remembered;
/**
Get device details for a specific deviceId.
*/
- (AWSTask<AWSCognitoIdentityUserGetDeviceResponse *> *) getDevice: (NSString *) deviceId;
/**
Convenience method to get device details for this device.
*/
- (AWSTask<AWSCognitoIdentityUserGetDeviceResponse *> *) getDevice;
/**
Forget (stop tracking) a specific deviceId.
*/
- (AWSTask *) forgetDevice: (NSString *) deviceId;
/**
Forget (stop tracking) this device.
*/
- (AWSTask *) forgetDevice;
@end
Swift
class AWSCognitoIdentityUser : NSObject
Undocumented
-
The username of this user
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *username;
Swift
var username: String? { get }
-
If this user is a result of a signup, this has the confirmation status
Declaration
Objective-C
@property (nonatomic, readonly) AWSCognitoIdentityUserStatus confirmedStatus;
Swift
var confirmedStatus: AWSCognitoIdentityUserStatus { get }
-
Determines whether this user has an active session or not. If the refresh token is expired the user will be prompted to authenticate when you call getSession.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isSignedIn) BOOL signedIn;
Swift
var isSignedIn: Bool { get }
-
Determines whether this user’s session is revocable. If the access token has “origin_jti” claim, then the revocation feature is enabled.
Declaration
Objective-C
@property (nonatomic, readonly, getter=isSessionRevocable) BOOL sessionRevocable;
Swift
var isSessionRevocable: Bool { get }
-
Deprecated
Use deviceIdentifier instead.
Get the device id
Warning
This function is deprecated and will be removed in an upcoming minor version of the SDK. You should use deviceIdentifier instead. @deprecated Use deviceIdentifier instead.Declaration
Objective-C
@property (nonatomic, readonly) DEPRECATED_MSG_ATTRIBUTE("Use deviceIdentifier instead.") NSString *deviceId;
Swift
var deviceId: String { get }
-
Get the device id
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *deviceIdentifier;
Swift
var deviceIdentifier: String? { get }
-
Confirm a users’ sign up with the confirmation code
Declaration
Objective-C
- (id)confirmSignUp:(nonnull NSString *)confirmationCode;
Swift
func confirmSignUp(_ confirmationCode: String) -> Any!
-
Confirm a users’ sign up with the confirmation code. If forceAliasCreation is set, if another user is aliased to the same email/phone this code was sent to, reassign alias to this user.
Declaration
Objective-C
- (id)confirmSignUp:(nonnull NSString *)confirmationCode forceAliasCreation:(BOOL)forceAliasCreation;
Swift
func confirmSignUp(_ confirmationCode: String, forceAliasCreation: Bool) -> Any!
-
Undocumented
Declaration
Objective-C
-(AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *) confirmSignUp:(NSString *) confirmationCode clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
Swift
func confirmSignUp(_ confirmationCode: String, clientMetaData: [String : String]?) -> Any!
-
Undocumented
Declaration
Objective-C
-(AWSTask<AWSCognitoIdentityUserConfirmSignUpResponse *> *) confirmSignUp:(NSString *) confirmationCode forceAliasCreation:(BOOL)forceAliasCreation clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
Swift
func confirmSignUp(_ confirmationCode: String, forceAliasCreation: Bool, clientMetaData: [String : String]?) -> Any!
-
Resend the confirmation code sent during sign up
Declaration
Objective-C
- (id)resendConfirmationCode: (nullable NSDictionary<NSString *, NSString *> *)clientMetaData;
Swift
func resendConfirmationCode(_ clientMetaData: [String : String]?) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserResendConfirmationCodeResponse *> *)resendConfirmationCode;
Swift
func resendConfirmationCode() -> Any!
-
Get a session with id, access and refresh tokens.
Declaration
Objective-C
- (id)getSession;
Swift
func getSession() -> Any!
-
Get a session with the following username and password
Declaration
Objective-C
- (id)getSession:(nonnull NSString *)username password:(nonnull NSString *)password validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *) validationData;
Swift
func getSession(_ username: String, password: String, validationData: [AWSCognitoIdentityUserAttributeType]?) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username password:(NSString *)password validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData;
Swift
func getSession(_ username: String, password: String, validationData: [AWSCognitoIdentityUserAttributeType]?, clientMetaData: [String : String]?) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username password:(NSString *)password validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData isInitialCustomChallenge:(BOOL)isInitialCustomChallenge;
Swift
func getSession(_ username: String, password: String, validationData: [AWSCognitoIdentityUserAttributeType]?, isInitialCustomChallenge: Bool) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserSession *> *)getSession:(NSString *)username password:(NSString *)password validationData:(nullable NSArray<AWSCognitoIdentityUserAttributeType *> *)validationData clientMetaData:(nullable NSDictionary<NSString *, NSString*> *) clientMetaData isInitialCustomChallenge:(BOOL)isInitialCustomChallenge;
Swift
func getSession(_ username: String, password: String, validationData: [AWSCognitoIdentityUserAttributeType]?, clientMetaData: [String : String]?, isInitialCustomChallenge: Bool) -> Any!
-
Get details about this user, including user attributes
Declaration
Objective-C
- (id)getDetails;
Swift
func getDetails() -> Any!
-
Send a code to this user to initiate the forgot password flow
Declaration
Objective-C
- (id)forgotPassword: (nullable NSDictionary<NSString *, NSString *> *)clientMetaData;
Swift
func forgotPassword(_ clientMetaData: [String : String]?) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserForgotPasswordResponse *> *)forgotPassword;
Swift
func forgotPassword() -> Any!
-
Conclude the forgot password flow by providing the forgot password code and new password.
Declaration
Objective-C
- (id)confirmForgotPassword:(nonnull NSString *)confirmationCode password:(nonnull NSString *)password clientMetaData:(nullable NSDictionary<NSString *, NSString *> *) clientMetaData;
Swift
func confirmForgotPassword(_ confirmationCode: String, password: String, clientMetaData: [String : String]?) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserConfirmForgotPasswordResponse *> *)confirmForgotPassword:(NSString *)confirmationCode password:(NSString *)password;
Swift
func confirmForgotPassword(_ confirmationCode: String, password: String) -> Any!
-
Change this user’s password
Declaration
Objective-C
- (id)changePassword:(nonnull NSString *)currentPassword proposedPassword:(nonnull NSString *)proposedPassword;
Swift
func changePassword(_ currentPassword: String, proposedPassword: String) -> Any!
-
Update this user’s attributes
Declaration
Objective-C
- (id)updateAttributes: (nonnull NSArray<AWSCognitoIdentityUserAttributeType *> *)attributes clientMetaData: (nullable NSDictionary<NSString *, NSString *> *)clientMetaData;
Swift
func update(_ attributes: [AWSCognitoIdentityUserAttributeType], clientMetaData: [String : String]?) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserUpdateAttributesResponse *> *)updateAttributes:(NSArray<AWSCognitoIdentityUserAttributeType *> *)attributes;
Swift
func update(_ attributes: [AWSCognitoIdentityUserAttributeType]) -> Any!
-
Delete the attributes specified by attributeNames
Declaration
Objective-C
- (id)deleteAttributes:(nonnull NSArray<NSString *> *)attributeNames;
Swift
func deleteAttributes(_ attributeNames: [String]) -> Any!
-
Verify a user attribute upon receiving the verification code.
Declaration
Objective-C
- (id)verifyAttribute:(nonnull NSString *)attributeName code:(nonnull NSString *)code;
Swift
func verifyAttribute(_ attributeName: String, code: String) -> Any!
-
Request a verification code to verify an attribute.
Declaration
Objective-C
- (id)getAttributeVerificationCode:(nonnull NSString *)attributeName clientMetaData: (nullable NSDictionary<NSString *, NSString *> *) clientMetaData;
Swift
func getAttributeVerificationCode(_ attributeName: String, clientMetaData: [String : String]?) -> Any!
-
Undocumented
Declaration
Objective-C
- (AWSTask<AWSCognitoIdentityUserGetAttributeVerificationCodeResponse *> *)getAttributeVerificationCode:(NSString *)attributeName;
Swift
func getAttributeVerificationCode(_ attributeName: String) -> Any!
-
Set the user settings for this user such as MFA
Declaration
Objective-C
- (id)setUserSettings:(nonnull AWSCognitoIdentityUserSettings *)settings;
Swift
func setUserSettings(_ settings: AWSCognitoIdentityUserSettings) -> Any!
-
Set the user mfa preference supercedes SetUserSettings
Declaration
Objective-C
- (id)setUserMfaPreference: (nonnull AWSCognitoIdentityUserMfaPreferences *)preferences;
Swift
func setUserMfaPreference(_ preferences: AWSCognitoIdentityUserMfaPreferences) -> Any!
-
Start the process of associating a software token
Declaration
Objective-C
- (id)associateSoftwareToken;
Swift
func associateSoftwareToken() -> Any!
-
Complete the process of associating a software token by verifying the code and setting device friendly name
Declaration
Objective-C
- (id)verifySoftwareToken:(nonnull NSString *)userCode friendlyDeviceName:(NSString *_Nullable)friendlyDeviceName;
Swift
func verifySoftwareToken(_ userCode: String, friendlyDeviceName: String?) -> Any!
-
Delete this user
Declaration
Objective-C
- (id)deleteUser;
Swift
func delete() -> Any!
-
Remove all sessions from the keychain for this user. Last known user remains.
Declaration
Objective-C
- (void)signOut;
Swift
func signOut()
-
Revoke all tokens for this user. Check Access Token for claims for validity to revoke tokens.
Declaration
Objective-C
- (id)revokeToken;
Swift
func revokeToken() -> Any!
-
Invalidate any active sessions with the service. Last known user remains.
Declaration
Objective-C
- (id)globalSignOut;
Swift
func globalSignOut() -> Any!
-
Remove all sessions from the keychain for this user and clear last known user.
Declaration
Objective-C
- (void)signOutAndClearLastKnownUser;
Swift
func signOutAndClearLastKnownUser()
-
Remove the id and access token from the keychain, but keep the refresh token. Use this when you have updated user attributes and want to refresh the id and access tokens.
Declaration
Objective-C
- (void)clearSession;
Swift
func clearSession()
-
List devices for this user
Declaration
Objective-C
- (id)listDevices:(int)limit paginationToken:(NSString *_Nullable)paginationToken;
Swift
func listDevices(_ limit: Int32, paginationToken: String?) -> Any!
-
Update device remembered status for a specific device id.
Declaration
Objective-C
- (id)updateDeviceStatus:(nonnull NSString *)deviceId remembered:(BOOL)remembered;
Swift
func updateDeviceStatus(_ deviceId: String, remembered: Bool) -> Any!
-
Convenience method to update device remembered status for this device.
Declaration
Objective-C
- (id)updateDeviceStatus:(BOOL)remembered;
Swift
func updateDeviceStatus(_ remembered: Bool) -> Any!
-
Get device details for a specific deviceId.
Declaration
Objective-C
- (id)getDevice:(nonnull NSString *)deviceId;
Swift
func getDevice(_ deviceId: String) -> Any!
-
Convenience method to get device details for this device.
Declaration
Objective-C
- (id)getDevice;
Swift
func getDevice() -> Any!
-
Forget (stop tracking) a specific deviceId.
Declaration
Objective-C
- (id)forgetDevice:(nonnull NSString *)deviceId;
Swift
func forgetDevice(_ deviceId: String) -> Any!
-
Forget (stop tracking) this device.
Declaration
Objective-C
- (id)forgetDevice;
Swift
func forgetDevice() -> Any!