![.NET on AWS Banner](./../logo.png ".NET on AWS") # Users management using the ASP.NET Core Identity Provider for Amazon Cognito ## Retrieve a CognitoUser phone number or email In addition to the attributes property of the CognitoUserClass, the CognitoUserManager class exposes the following methods to retrieve a CognitoUser phone number or email: ```csharp /// /// Gets the telephone number, if any, for the specified . /// /// The user whose telephone number should be retrieved. /// The that represents the asynchronous operation, containing the user's telephone number, if any. Task GetPhoneNumberAsync(TUser user); /// /// Gets the email address for the specified . /// /// The user whose email should be returned. /// The task object containing the results of the asynchronous operation, the email address for the specified . Task GetEmailAsync(TUser user); ``` ## Update a CognitoUser phone number or email The CognitoUserManager class exposes the following methods to update a CognitoUser phone number or email: ```csharp /// /// Sets the phone number for the specified . /// /// The user whose phone number to set. /// The phone number to set. /// /// The that represents the asynchronous operation, containing the /// of the operation. /// Task SetPhoneNumberAsync(TUser user, string phoneNumber); /// /// Sets the address for a . /// /// The user whose email should be set. /// The email to set. /// /// The that represents the asynchronous operation, containing the /// of the operation. /// Task SetEmailAsync(TUser user, string email); ``` ## Resend the email or phone number confirmation token The CognitoUserManager class exposes the following methods to resend the email or phone number confirmation token to the CognitoUser: ```csharp /// /// Generates and sends an email confirmation token for the specified user. /// /// The user to generate and send an email confirmation token for. /// /// The that represents the asynchronous operation, containing the /// of the operation. /// Task SendEmailConfirmationTokenAsync(TUser user); /// /// Generates and sends a phone confirmation token for the specified user. /// /// The user to generate and send a phone confirmation token for. /// /// The that represents the asynchronous operation, containing the /// of the operation. /// Task SendPhoneConfirmationTokenAsync(TUser user); ``` If the output result is successful, a confirmation token would have been sent to the CognitoUser either via email or phone. ## Verify an email or phone number using the confirmation token The CognitoUserManager class exposes the following methods to verify an email or phone number using the confirmation token for a specified CognitoUser: ```csharp /// /// Confirms the email of an user by validating that an email confirmation token is valid for the specified . /// This operation requires a logged in user. /// /// The user to validate the token against. /// The email confirmation code to validate. /// /// The that represents the asynchronous operation, containing the /// of the operation. /// Task ConfirmEmailAsync(TUser user, string confirmationCode); /// /// Confirms the phone number of an user by validating that an email confirmation token is valid for the specified . /// This operation requires a logged in user. /// /// The user to validate the token against. /// The phone number confirmation code to validate. /// /// The that represents the asynchronous operation, containing the /// of the operation. /// Task ConfirmPhoneNumberAsync(TUser user, string confirmationCode); ```