A newer version of this documentation is available.

View Latest

updateEmail

client.updateEmail(
  authToken,
  email,
  success,
  failure,
  // Optional arguments
  redirectUrl
)

About this command

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

  • Your access token must have the full_write scope.

  • Be sure to configure and to enable the Email update template in the account’s settings.

Examples

import com.reach5.identity.sdk.core.models.AuthToken

val authToken: AuthToken = // The authentication token obtained following signup or login.

client.updateEmail(
    authToken = authToken,
    email = "johnatthan.doe@gmail.com",
    redirectUrl = "https://example-email-update.com"
    success = { updatedProfile -> ... }, // Get the updated profile
    failure = { error -> ... } // Handle a ReachFive error
)

Parameters

Parameter Description

failure function

Callback called once the request has failed. You’ll get a ReachFiveError as an argument.

AuthToken

Authorization token of the profile retrieved from login (less than 5 minutes old).

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.

redirectUrl string

The URL sent in the email to which the user is redirected. This URL must be whitelisted in the Allowed Callback URLs field of your ReachFive client settings.

success function

Callback called once the update has succeeded. You’ll get the updated Profile as an argument.

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.

Response

Type: Unit

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.

address_complement string

A complementary address field which can contain additional information about the address. This can be the floor, a door number, or any other useful address information.

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

The time the profile’s information was last updated.

ReachFiveError

message string

The message of the error.

getErrorCode() ErrorCode

The error code’s enumeration value.

code string

The HTTP status code or SDK error code.

exception string

The stack trace of the error.

data ReachFiveApiError

Additional data about the 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 technical error code.

errorDescription string

The technical error message.

errorDetails ReachFiveApiErrorDetails

  • field - The field concerned by the error.

  • message - The message error returned for the field.