updateEmail

AppDelegate.reachfive().updateEmail(
    authToken,
    email,
    // Optional arguments
    redirectUrl
)

Description

Update the profile’s email address and send a verification email.

  • The profile must have been granted the full_write scope at the last authentication.

  • It is required to configure and to enable the Email update template in the account’s settings.

Examples

import IdentitySdkCore

let profileAuthToken: AuthToken = // Here paste the authorization token of the profile retrieved after login

AppDelegate
  .reachfive()
  .updateEmail(
      authToken: profileAuthToken,
      email: "johnatthan.doe@gmail.com",
      redirectUrl: "https://example-email-update.com"
  )
  .onSuccess { updatedProfile in
    // Get the updated profile
  }
  .onFailure { error in
    // Return a ReachFive error
  }

Parameters

Parameter Description

authToken AuthToken

Authorization token of the profile retrieved from login.

idToken string

The ID token JSON Web Token (JWT) that contains the profile’s information.

accessToken string

The authorization credential JSON Web Token (JWT) used to access the ReachFive API.

refreshToken string

The refresh token JSON Web Token (JWT) used to obtain new access tokens once they expire.

tokenType string

The type of token. Always equal to Bearer.

expiresIn number

The lifetime in seconds of the access token.

If expiresIn is less than or equal to 0, the AuthToken is expired.

user OpenIdUser

The user’s information contained in the ID token.

email string

The email address of the profile. The new email address must be different from the old one.

Unverified emails

If the email being updated is unverified, the user’s email is updated immediately.

Verified emails

If the email being updated is verified, the user must click on the verification link sent in the email to finish the update email flow. Users won’t be able to use the new email for authentication until it is verified.

For more, see our Email address management page.

redirectUrl string

The URL to which the user is redirected.

This URL must be whitelisted in the Allowed Callback URLs field of your ReachFive client settings.

Response

Type: Future<Profile, ReachFiveError>

Return the profile with the updated email address.

The promise will be rejected and will return a ReachFiveError if:

  • The parameters are invalid,

  • The full_write scope is missing,

  • The email template is incomplete.

Profile

id string

The ReachFive identifier of the profile.

givenName string

The given name of the profile.

middleName string

The middle name of the profile.

familyName string

The family name of the profile.

name string

The full name of the profile.

nickname string

The nickname of the profile.

birthdate string

The birthdate of the profile, represented as an ISO 8601 YYYY-MM-DD format.

profileURL string

The URL of one of the user’s profile page (usually a social provider’s page).

picture string

The URL of one of the profile picture. This URL refers to an image file (PNG, JPEG, or GIF image file).

externalId string

The external identifier of the profile.

authTypes String[]

The list of the authentication providers used to login by the profile (e.g. facebook, password …​).

loginSummary LoginSummary

The login activities history of the profile.

firstLogin string

The time of the first login.

lastLogin string

The time of the last login.

total string

The number of login.

origins string

Some additional information about the login.

devices string

The devices used for login (desktop, ios, android, mobile_web and windows_phone).

lastProvider string

The last provider used for login (e.g. local, lite, facebook …​).

username string

The username of the profile (the login’s name).

gender string

The gender of the profile.

Allowed values are female, male and other.

email string

The primary email address of the profile.

emailVerified boolean

true if the profile’s e-mail address has been verified; otherwise false.

emails Emails

The e-mail addresses of the profile.

verified string[]

The list of the verified e-mail addresses of the profile.

unverified string[]

The list of the unverified e-mail addresses of the profile.

phoneNumber string

The primary phone number of the profile.

Both the international format and the national conventions of the account’s country are accepted if configured in account settings.

phoneNumberVerified boolean

true if the user’s phone number has been verified; otherwise false.

addresses List of ProfileAddress

The list of the profile’s postal addresses. To get this attribute, the profile must have been granted the address scope at the last authentication.

title string

The title of the address.

This value can’t be an empty string.

isDefault boolean

Whether the address is the default postal address of the profile. Only a single address can be the default address.

Defaults to true.

addressType string

The type of address

Allowed values: delivery or billing.

streetAddress string

The full street address component which may include the house number, the street’s name and the extended street address information separated by newlines.

This value can’t be an empty string.

A complementary address field which can contain additional information about the address. !locality string!The name of the city. !region string!The name of the region. !postalCode string!The zip code. !country string!The name of the country.

This value can’t be an empty string. !deliveryNote string!An additional note from the profile for the delivery. !recipient string!The name of the recipient located at this address. !company string!The name of the company located at this address. !phoneNumber string!The phone number of the contact point at this address (no format validation is required). !===

locale string

The profile’s language code in lowercase and country code in uppercase, separated by a dash (e.g. en, fr-FR …​).

bio string

The biography of the profile.

customFields Map<string, any>

The custom fields of the profile.

consents Map<string, Consent>

The consents granted to the profile. It is a map of string keys with the associated consent object.

!=== !granted boolean!Whether the consent was granted to the profile or not. !consentType boolean!The type of consent.

Allowed values: opt-in opt-out. !date string!The time the consent was last updated. !===

createdAt string

The time the profile’s information was created.

updatedAt string

ReachFiveError

Based on the problem, the ReachFiveError will be:

  • RequestError(requestErrors: RequestErrors) if it’s a bad request error.

    error string

    The main error message.

    errorId string

    The identifier of the error.

    errorUserMsg string

    The user-friendly error message.

    This property is translated according to the user’s browser settings. Currently supported languages:
    Currently supported languages
    • ar - العربية Arabic

    • de - Deutsch German

    • en - English

    • es - Español Spanish

    • fr - Français French

    • hu - Magyar Hungarian

    • it - Italiano Italian

    • jp - 日本 Japanese

    • ko - 한국인 Korean

    • nl - Nederlands Dutch

    • pt - Portuguese

    • ru - Ру́сский Russian

    • sk - Slovenský Slovak

    • zh-CN - People’s Republic of China Simplified Chinese

    • zh-Hans - Simplified Chinese

    • zh-Hant - Traditional Chinese

    • zh-HK - Hong Kong Traditional Chinese

    • zh-MO - Macao Traditional Chinese

    • zh-SG - Singapore Simplified Chinese

    • zh-TW - Taiwan Traditional Chinese

    errorMessageKey string

    The error message key.

    errorDescription string

    The technical error message.

    errorDetails FieldError[]

    field string

    The field concerned by the error.

    message string

    The message error returned for the field.

    code string

    The code error returned for the field.

    • AuthFailure(reason: String) if the authentication has failed.

    • AuthCanceled if the authentication was cancelled.

    • TechnicalError(reason: String) if it’s an internal server error.