Introduction

Below are all the functions accessible via the iOS SDK.

In all the code examples below, the Reachfive client is instantiated and stored in your AppDelegate class. You can access it through the AppDelegate.reachfive() method.

Core commands

AddPasswordlessCallback

The callback that will be executed when the magic link is intercepted.

Arguments
  • passwordlessCallback

    PasswordlessCallback

Definition
AppDelegate.reachfive().addPasswordlessCallback { result in }
Example Request
import IdentitySdkCore
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    AppDelegate.reachfive().addPasswordlessCallback { result in
      switch (result) {
        case .success(authToken):
          // Handle authToken
        case .failure(error):
          // Handle error
      }
    }
    
    return true
  }
}

StartPasswordless

Starts passwordless flow by sending an email or a sms to the user with a single-use auth code.

Arguments
  • passwordLessRequest

    PasswordLessRequest

    Email or PhoneNumber

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

  • verificationCode

    string

    The verification code sent by SMS.

Response

Type: Future<(), ReachFiveError>

Definition
AppDelegate.reachfive().startPasswordless(.Email(email: email))
Example Request
import IdentitySdkCore

let email = "..."
AppDelegate.reachfive()
  .startPasswordless(.Email(email: email))
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

// Or

let phoneNumber = "..."
AppDelegate.reachfive()
  .startPasswordless(.PhoneNumber(phoneNumber: phoneNumber))
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

VerifyPasswordlessCode

Verify the verification code sent by SMS

Arguments

Response

Type: Future<AuthToken, ReachFiveError>

If the credentials are valid, the promise will return the profile's authentication token. Otherwise it will be rejected and will return a ReachFiveError.

Definition
AppDelegate.reachfive().verifyPasswordlessCode(verifyAuthCodeRequest: verifyAuthCodeRequest)
Example Request
import IdentitySdkCore

let verifyAuthCodeRequest = VerifyAuthCodeRequest(
  phoneNumber: phoneNumberInput,
  verificationCode: verificationCodeInput
)
AppDelegate.reachfive()
  .onSuccess{ _ in
    // Do something
  }
  .onFailure { error in
    // Return a ReachFive error
  }

getProfile

Retrieve the profile's information.

Note: the profile must have been granted the profile scope at the last authentication otherwise the profile's attributes are null.

Arguments
  • authToken

    The authorization token of the profile retrieved from login.

Response

Type: Future<Profile, ReachFiveError>

It will return the fetched profile, otherwise you'll get a ReachFiveError.

Definition
AppDelegate.reachfive().getProfile(authToken)
Example Request
import IdentitySdkCore

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

AppDelegate
    .reachfive()
    .getProfile(authToken: profileAuthToken)
    .onSuccess { profile in 
      // Get the profile 
    }
    .onFailure { error in 
      // Return a ReachFive error 
    }

getProvider

Retrieve a provider registered on the ReachFive client by name.

Refer at the iOS SDK Installation to initialize the providers at the client's instantiation.

Note: the scopes provided are the permissions setup in the provider's configuration through the console.

Arguments
  • name

    string

    The name of the provider.

Response

Type: Provider

It will return the provider which name matches the name passed in argument.

Definition
AppDelegate.reachfive().getProvider(name)
Example Request
import IdentitySdkCore

let providerName: String = // Here paste the name of the provider

let provider = AppDelegate
    .reachfive()
    .getProvider(name: providerName)

getProviders

Retrieve all the providers registered on the ReachFive client.

Refer at the iOS SDK Installation to initialize the providers at the client's instantiation.

Note: the scopes provided are the permissions setup in the provider's configuration through the console.

Response

Type: Array of Providers

It will return the list of providers.

Definition
AppDelegate.reachfive().getProviders()
Example Request
import IdentitySdkCore

let providers = AppDelegate.reachfive().getProviders()

loginWithPassword

Authenticate the user with the specified identifier (email or phone number) and password.

A user may identify himself with either his email address or his phone number if the SMS feature is enabled.

Arguments
  • username

    string

    The username of the profile. It can be his email address or phone number.

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

  • password

    string

    The password of the profile.

  • scope

    optional Array of string

    The scopes granted to the profile. Make sure they are allowed by the client.

    Default scopes are the allowed scopes set up in the client's configuration.

Response

Type: Future<AuthToken, ReachFiveError>

If the credentials are valid, the promise will return the profile's authentification token. Otherwise it will be rejected and will return a ReachFiveError.

Definition
AppDelegate.reachfive().loginWithPassword(username, password, scope)
Example Request
// Login with an email
AppDelegate
    .reachfive()
    .loginWithPassword(
        username: "john.doe@gmail.com",
        password: "UCrcF4RH",
        scope: ["openid", "profile", "email"]
    )
    .onSuccess{ authToken in
        // Get the profile's authentification token
    }
    .onFailure { error in
        // Return a ReachFive error
    }

// Login with a phone number
AppDelegate
  .reachfive()
  .loginWithPassword(
      username: "+33682234940",
      password: "UCrcF4RH",
      scope: ["openid", "profile", "email"]
  )
  .onSuccess{ authToken in
      // Get the profile's authentification token
  }
  .onFailure { error in
      // Return a ReachFive error
  }

logout

Kill the SSO session of the profile.

Response

Type: Future<(), ReachFiveError>

Definition
AppDelegate.reachfive().logout()
Example Request
AppDelegate
  .reachfive()
  .logout()
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

refreshAccessToken

Obtain a new AuthToken once your access token has expired.

Notes:

  • An expired access token (short-lived) can be renewed using a refresh token (long-lived).
  • The profile must have been granted the offline_access scope at the last authentication in order to obtain a refresh token.
  • In order for a refresh token to be included in your AuthToken, your client must be configured on the ReachFive console to enforce PKCE and to enable refresh tokens.
Arguments
  • authToken

    The authorization token of the profile retrieved from login.

Response

Type: Future<AuthToken, ReachFiveError>

If the credentials are valid, the promise will return the profile's authentification token. Otherwise it will be rejected and will return a ReachFiveError.

Definition
AppDelegate.reachfive().refreshAccessToken(authToken)
Example Request
import IdentitySdkCore

val authToken: AuthToken = // The authentification token obtained from login or signup.

AppDelegate.reachfive()
      .refreshAccessToken(authToken)
      .onSuccess{ refreshedAuthToken in
        // Do something
      }
      .onFailure { error in
        // Return a ReachFive error
      }

requestPasswordReset

Request a password reset for a profile. It will send an email if the email address is provided and an SMS if the phone number is given.

It is required to configure and to enable the Password reset email or the Password reset SMS templates in the account's settings.

Arguments
  • email

    optional string

    The email address of the profile.

  • redirectUrl

    optional string

    The URL sent in the reset password email to which the profile is redirected.

  • phoneNumber

    optional string

    The 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.

Response

Type: Future<(), ReachFiveError>

If the identifier is invalid or if the templates are incomplete, the promise will be rejected and will return a ReachFiveError. Otherwise, the profile will receive an email or an SMS.

Definition
AppDelegate.reachfive().requestPasswordReset(email, phoneNumber, redirectUrl)
Example Request
// Send an email
AppDelegate
  .reachfive()
  .requestPasswordReset(
      email: "john.doe@gmail.com",
      redirectUrl: "https://example-password-reset.com"
  )
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

// Send an SMS
AppDelegate
  .reachfive()
  .requestPasswordReset(phoneNumber: "+33682234940")
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

signup

Create and authenticate a new user with the specified data.

A user may identify himself with either his email address or his phone number if the SMS feature is enabled.

Arguments
  • The data of the profile.

  • scope

    optional Array of string

    The scopes granted to the profile. Make sure they are allowed by the client.

    Default scopes are the allowed scopes set up in the client's configuration.

Response

Type: Future<AuthToken, ReachFiveError>

If the parameters are invalid or if a profile already exists with the same email address, the promise will be rejected and will return a ReachFiveError. Otherwise, it will return the profile's authentification token.

Definition
AppDelegate.reachfive().signup(profile, scope)
Example Request
import IdentitySdkCore

AppDelegate
  .reachfive()
  .signup(
      profile: ProfileSignupRequest(
        givenName: "Jonh",
        familyName: "Doe",
        gender: "male",
        email: "john.doe@gmail.com",
        password: "hjk90wxc"
      ),
      scope: ["openid", "profile", "email"]
  )
  .onSuccess{ authToken in
      // Get the profile's authentification token
  }
  .onFailure { error in
      // Return a ReachFive error
  }

updateEmail

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

Notes:

  • The profile must have been granted the full_write scope at the last authentication.
  • It is required to configure and to enable the Verification email template in the account's settings.
Arguments
  • authToken

    The authorization token of the profile retrieved from login.

  • email

    string

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

  • redirectUrl

    optional string

    The URL sent in the verification email to which the profile is redirected.

Response

Type: Future<Profile, ReachFiveError>

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.

Otherwise, it will return the profile with the updated email address.

Definition
AppDelegate.reachfive().updateEmail(authToken, email, redirectUrl)
Example Request
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 
  }

updatePassword

Update the profile's password. The parameters required in addition to the new password are either:

  • a fresh access token (less than 5 minutes old).
  • the old password.
  • the profile's email address/phone number and the verification code sent by email/SMS through a request password reset flow.

Notes: the profile must have been granted the full_write scope at the last authentication.

Arguments

Response

Type: Future<(), ReachFiveError>

The promise will be rejected and will return a ReachFiveError if the parameters are invalid or if the full_write scope is missing.

Definition
AppDelegate.reachfive().updatePassword(updatePasswordRequest)
Example Request
import IdentitySdkCore

// Update the password with a fresh access token
let freshProfileAuthToken: AuthToken = // Here paste the authorization token of the profile retrieved after login (less than 5 min)
AppDelegate
  .reachfive()
  .updatePassword(.FreshAccessTokenParams(authToken: freshProfileAuthToken, password: "ZPf7LFtc"))
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

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

// Update the password by providing the old one
AppDelegate
  .reachfive()
  .updatePassword(.AccessTokenParams(authToken: profileAuthToken, oldPassword: "gVc7piBn", password: "ZPf7LFtc"))
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

// Update the password with a verification code retrieved from an email
AppDelegate
  .reachfive()
  .updatePassword(.EmailParams(email: "john.doe@example.com", verificationCode: "234", password: "ZPf7LFtc"))
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

// Update the password with a verification code retrieved from an SMS
AppDelegate
  .reachfive()
  .updatePassword(.SmsParams(phoneNumber: "+33682234940", verificationCode: "234", password: "ZPf7LFtc"))
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

updatePhoneNumber

Update the profile's phone number and send a verification code by SMS.

Notes:

  • The profile must have been granted the full_write scope at the last authentication.
  • It is required to configure and to enable the Verification SMS template in the account's settings.
Arguments
  • authToken

    The authorization token of the profile retrieved from login.

  • phoneNumber

    string

    The phone number of the profile. The new phone number can be identical to the old one.

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

Response

Type: Future<Profile, ReachFiveError>

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

  • the parameters are invalid,
  • the full_write scope is missing,
  • the SMS template is incomplete.

Otherwise, it will return the profile with the updated phone number.

Definition
AppDelegate.reachfive().updatePhoneNumber(authToken, phoneNumber)
Example Request
import IdentitySdkCore

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

AppDelegate
  .reachfive()
  .updatePhoneNumber(
      authToken: profileAuthToken,
      phoneNumber: "+33792244940"
  )
  .onSuccess { updatedProfile in 
    // Get the updated profile
  }
  .onFailure { error in 
    // Return a ReachFive error 
  }

updateProfile

Update the information of the profile.

Notes:

  • The profile must have been granted the full_write scope at the last authentication.
  • The email and the password fields of the profile can't be updated with this method, except if the profile has no email address (generally when it is not provided by the social provider). Use instead the updateEmail method.
  • The phoneNumber field of the profile can't be updated if the SMS verification code is disabled on the account settings.
Arguments
  • authToken

    The authorization token of the profile retrieved from login.

  • profile

    The profile with the new data. Only the provided fields will be updated.

Response

Type: <Profile, ReachFiveError>

If the parameters are invalid or if the full_write scope is missing, the promise will be rejected and will return a ReachFiveError. Otherwise, it will return the profile with the updated data.

Definition
AppDelegate.reachfive().updateProfile(authToken, profile)
Example Request
import IdentitySdkCore

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

AppDelegate
  .reachfive()
  .updateProfile(
      authToken: profileAuthToken,
      profile: Profile(givenName: "Jonhatthan", phoneNumber: "+33750253354")
  )
  .onSuccess { updatedProfile in 
    // Get the updated profile
  }
  .onFailure { error in 
    // Return a ReachFive error 
  }

verifyPhoneNumber

Verify the profile's phone number with the verification code sent by SMS after signup.

Note: the profile must have been granted the full_write scope at the last authentication.

Arguments
  • authToken

    The authorization token of the profile retrieved from login.

  • phoneNumber

    string

    The 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.

  • verificationCode

    string

    The verification code sent by SMS.

Response

Type: Future<(), ReachFiveError>

If the full_write scope is missing or if the verification code is incorrect, the promise will be rejected and will return a ReachFiveError.

Definition
AppDelegate.reachfive().verifyPhoneNumber(authToken, phoneNumber, verificationCode)
Example Request
import IdentitySdkCore

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

AppDelegate
  .reachfive()
  .verifyPhoneNumber(
      authToken: profileAuthToken,
      phoneNumber: "+33750253354",
      verificationCode: "501028"
  )
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

Models

AuthToken

Attributes
  • idToken

    optional string

    The ID token (Json Web Token) that contains the profile's information.

  • accessToken

    string

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

  • tokenType

    optional string

    The type of token. Always equal to Bearer.

  • expiresIn

    optional number

    The lifetime in seconds of the access token.

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

  • user

    optional OpenIdUser

    The user's information contained in the ID token.

Emails

Attributes
  • verified

    optional List of string

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

  • unverified

    optional List of string

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

FieldError

Attributes
  • field

    optional string

    The field concerned by the error.

  • message

    optional string

    The message error returned for the field.

  • code

    optional string

    The code error returned for the field.

LoginSummary

Attributes
  • firstLogin

    optional long

    The time of the first login.

  • lastLogin

    optional long

    The time of the last login.

  • total

    optional int

    The number of login.

  • origins

    optional List of string

    Some additional information about the login.

  • devices

    optional List of string

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

  • lastProvider

    optional string

    The last provider used for login (eg local, lite, facebook ...).

OpenIdUser

User information specified by OpenId Connect.

Attributes
  • id

    optional string

    The identifier of the user.

  • name

    optional string

    The full name of the user in displayable form including all name parts, possibly including titles and suffixes, ordered according to the user's locale and preferences.

  • preferredUsername

    optional string

    The shorthand name by which the user wishes to be referred to.

  • givenName

    optional string

    The given name or first name of the user.

  • familyName

    optional string

    The surname or last name of the user.

  • middleName

    optional string

    The middle name of the user.

  • nickname

    optional string

    The casual name of the user that may or may not be the same as the givenName.

  • picture

    optional string

    The URL of the user's profile picture.

  • website

    optional string

    The URL of the user's web page or blog.

  • email

    optional string

    The user's preferred e-mail address.

  • emailVerified

    optional boolean

    True if the user's e-mail address has been verified; otherwise false.

  • gender

    optional string

    The user's gender.

  • zoneinfo

    optional string

    The sring from zoneinfo time zone database representing the user's time zone.

  • locale

    optional string

    The user's language code in lowercase and country code in uppercase, separated by a dash.

  • phoneNumber

    optional string

    The user's preferred telephone number.

  • phoneNumberVerified

    optional boolean

    True if the user's phone number has been verified; otherwise false.

  • address

    optional string

    The user's preferred postal address.

  • birthdate

    optional string

    The user's birthday, represented as an YYYY-MM-DD format.

Profile

Attributes
  • uid

    optional string

    The ReachFive identifier of the profile.

  • givenName

    optional string

    The given name of the profile.

  • middleName

    optional string

    The middle name of the profile.

  • familyName

    optional string

    The family name of the profile.

  • name

    optional string

    The full name of the profile.

  • nickname

    optional string

    The nickname of the profile.

  • birthdate

    optional string

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

  • profileURL

    optional string

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

  • picture

    optional string

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

  • externalId

    optional string

    The external identifier of the profile.

  • authTypes

    optional List of string

    The list of the authentication providers used to login by the profile (eg facebook, password ...).

  • loginSummary

    optional LoginSummary

    The login activities history of the profile.

  • username

    optional string

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

  • gender

    optional string

    The gender of the profile.

    Allowed values are female, male and other.

  • email

    optional string

    The primary email address of the profile.

  • emailVerified

    optional boolean

    True if the profile's e-mail address has been verified; otherwise false.

  • emails

    optional Emails

    The e-mail addresses of the profile.

  • phoneNumber

    optional 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

    optional boolean

    True if the user's phone number has been verified; otherwise false.

  • addresses

    optional 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.

  • locale

    optional string

    The profile's language code in lowercase and country code in uppercase, separated by a dash (eg en, fr-FR ...).

  • bio

    optional string

    The biography of the profile.

  • customFields

    optional Map<string, any>

    The custom fields of the profile.

  • consents

    optional Map<string, Consent>

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

  • tosAcceptedAt

    optional string

    The time the profile accepted the terms of service.

  • createdAt

    optional string

    The time the profile's information was created.

  • updatedAt

    optional string

    The time the profile's information was last updated.

  • liteOnly

    optional boolean

    Whether the profile is LITE only or not.

  • company

    optional string

    The company's name of the profile.

ProfileAddress

Attributes
  • title

    optional string

    The title of the address.

    This value can't be an empty string.

  • isDefault

    optional boolean

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

    Default: true.

  • addressType

    optional string

    The type of address

    Allowed values are delivery or billing.

  • streetAddress

    optional 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.

  • locality

    optional string

    The name of the city.

  • region

    optional string

    The name of the region.

  • postalCode

    optional string

    The zip code.

  • country

    optional string

    The name of the country.

    This value can't be an empty string.

  • deliveryNote

    optional string

    An additional note from the profile for the delivery.

  • recipient

    optional string

    The name of the recipient located at this address.

  • company

    optional string

    The name of the company located at this address.

  • phoneNumber

    optional string

    The phone number of the contact point at this address (no format validation is required).

ProfileSignupRequest

Attributes
  • password

    string

    The password of the profile. Password must meet the minimum requirements defined by the library used.

  • email

    optional string

    The primary email address of the profile.

  • phoneNumber

    optional 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.

  • givenName

    optional string

    The given name of the profile.

  • middleName

    optional string

    The middle name of the profile.

  • familyName

    optional string

    The family name of the profile.

  • name

    optional string

    The full name of the profile.

  • nickname

    optional string

    The nickname of the profile.

  • birthdate

    optional string

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

  • profileURL

    optional string

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

  • picture

    optional string

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

  • username

    optional string

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

  • gender

    optional string

    The gender of the profile.

    Allowed values are female, male and other.

  • company

    optional string

    The company's name of the profile.

  • addresses

    optional List of ProfileAddress

    The list of the profile's postal addresses.

  • locale

    optional string

    The profile's language code in lowercase and country code in uppercase, separated by a dash (eg en, fr-FR ...).

  • bio

    optional string

    The biography of the profile.

  • customFields

    optional Map<string, any>

    The custom fields of the profile.

  • consents

    optional Map<string, Consent>

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

  • tosAcceptedAt

    optional string

    The time the profile accepted the terms of service.

  • liteOnly

    optional boolean

    Whether the profile is LITE only or not.

Provider

Attributes
  • name

    string

    The name of the provider.

  • login

    function

    Function which authenticates the profile with the provider.

    Arguments:

    • scope (optional array of strings): The scopes granted to the profile. Make sure they are allowed by the client. Default scopes are the allowed scopes set up in the client's configuration.
    • origin (string): The origin of the call.
    • viewController (optional UIViewController): The iOS view controller.

    Response:

    Future<AuthToken, ReachFiveError>

    If the credentials are valid, the promise will return the profile's authentification token. Otherwise, it will be rejected and will return a ReachFiveError.

  • logout

    function

    Function which kills the SSO session of the profile.

    Response:

    Future<(), ReachFiveError>

Example
import UIKit
import IdentitySdkCore

// Login with the Facebook provider
AppDelegate
  .reachfive()
  .getProvider(name: "facebook")?
  .login(
      scope: ["openid", "email", "profile", "phone", "full_write"],
      origin: "home",
      viewController: self
  )
  .onSuccess{ authToken in
      // Get the profile's authentification token
  }
  .onFailure { error in
      // Return a ReachFive error
  }

// Logout from the Facebook provider
AppDelegate
  .reachfive()
  .getProvider(name: "facebook")?
  .logout()
  .onSuccess{ _ in
      // Do something
  }
  .onFailure { error in
      // Return a ReachFive error
  }

ReachFiveError

Based on the problem, the ReachFive error will be:

  • RequestError(requestErrors: RequestErrors) if it's a bad request error.
  • AuthFailure(reason: String) if the authentification has failed.
  • AuthCanceled if the authentification was cancelled.
  • TechnicalError(reason: String) if it's an internal server error.

RequestErrors

Attributes
  • error

    optional string

    The main error message.

  • errorId

    optional string

    The identifier of the error.

  • errorUserMsg

    optional string

    The user-friendly error message.

  • errorDescription

    optional string

    The technical error message.

  • errorDetails

    optional Array of FieldError

    More details about the error.

Example
{
    "error": "invalid_request",
    "errorId": "9W3kyNfEZN",
    "errorUserMsg": null,
    "errorDescription": "Validation failed",
    "errorDetails": [
        {
            "field": "data.email",
            "message": "Must be a valid email"
        }
    ]
}

{
    "error": "email_already_exists",
    "errorId": "b6tafffEBV",
    "errorUserMsg": "Another account with the same email address already exists",
    "errorDescription": "Email already in use",
    "errorDetails": null
}

UpdatePasswordRequest.AccessTokenParams

Attributes
  • authToken

    The authorization token of the profile retrieved from login.

  • oldPassword

    string

    The old password of the profile.

  • password

    string

    The new password of the profile. Password must meet the minimum requirements defined by the library used. It must also be different from the old one.

UpdatePasswordRequest.EmailParams

Attributes
  • email

    string

    The email address of the profile.

  • verificationCode

    string

    The verification code sent by email.

  • password

    string

    The new password of the profile. Password must meet the minimum requirements defined by the library used. It must also be different from the old one.

UpdatePasswordRequest.FreshAccessTokenParams

Attributes
  • freshAuthToken

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

  • password

    string

    The new password of the profile. Password must meet the minimum requirements defined by the library used. It must also be different from the old one.

UpdatePasswordRequest.SmsParams

Attributes
  • phoneNumber

    string

    The 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.

  • verificationCode

    string

    The verification code sent by SMS.

  • password

    string

    The new password of the profile. Password must meet the minimum requirements defined by the library used. It must also be different from the old one.

VerifyAuthCodeRequest

Attributes
  • phoneNumber

    string

    The 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.

  • verificationCode

    string

    The verification code sent by SMS.

  • email

    string

    The email address.