signup

client.signup({
  data: SignupProfile,
  // Optional parameters
  saveCredentials: boolean,
  redirectUrl: string,
  returnToAfterEmailConfirmation: string, (1)
  captchaToken: string,
  auth: AuthOptions
})
1 This parameter should only be used with Hosted Pages.

About this command

Create and authenticate a new user with the specified data.

A user may identify himself with either his email address or his phone number.

Examples

client
  .signup({
    data: {
      givenName: 'John',
      familyName: 'Doe',
      email: 'john.doe@example.com',
      password: 'N5uiKvve'
    },
    redirectUrl: 'https://example-email-validate.com'
  })
  .then(authResult => {
     // Retrieve the access token
  })
  .catch(err => console.error(err))

Parameters

options AuthOptions

List of authentication options

responseType string

The desired OAuth2 grant type. Use code to request an authorization code (recommended) or token for a token set (implicit grant, discouraged).

Defaults to code when redirectUri is provided, and to token otherwise. For messenger account linking, responseType should be set to messenger_code.

redirectUri string

The absolute URI the user-agent will be redirected to following flow completion. It will either carry the response type, or the appropriate error in case of failure. Any specified state string will also be included.

This parameter is required with code response type and defaults to the current page with token response type. For messenger account linking, redirectUri should be set with the redirect_uri query param provided by Facebook on URL.

redirectUri is still required when setting useWebMessage to true despite there being no redirection involved.

state string

An opaque value used to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client.

The parameter should be used for preventing cross-site request forgery as described in Section 10.12 of RFC 6749.

prompt string

Specify whether the flow should explicitly prompt the user for reauthentication or not.

This applies to the Login with session flow where a session cookie is provided.
In a Social Login (SLO) flow, the session management is partially delegated to the target OIDC provider (OP) and hence, prompt is handled by the OP and we redirect to the OP because of this.

The defined values are:

  • none: Require that no user interaction take place. This is typically used to silently check for existing authentication and/or consent.

    If no value for prompt is specified, none is the default value for non-orchestrated flows. For orchestrated flows, if no value for prompt is specified, users are redirected to the defined Login URL with their orchestration token.
  • login: The flow should prompt the user for reauthentication. The existing session is invalidated and the user is redirected to the redirect_uri or client-configured login URL (if no redirect_uri is specified).

  • consent: The flow should prompt for consent, otherwise an error must be returned to the client (consent_required).

nonce string

String value used to associate a client session with an ID Token, and to mitigate replay attacks. The value is passed through unmodified to the ID Token. Sufficient entropy must be present in the nonce values used to prevent attackers from guessing values. See Section 15.5.2 of OpenID Connect for more implementation details.

persistent boolean

When persistent is true, the session duration configured in the ReachFive Console (Settings  Security  SSO) applies.

If persistent is not set or is false, the default session duration of 1 day applies.

Defaults to true.

popupMode boolean

Whether or not to use popup mode.

Defaults to false.

This mode is not recommended due to known bugs in Android or Firefox in iOS.

useWebMessage boolean

When set to true, the SDK will leverage the web_message response mode in order to avoid having to redirect the user-agent to obtain the authorization response.

Defaults to false. If set to true and responseType is code, the authorization code will be automatically exchanged at the token endpoint along with any potential code_verifier.

origin string

Free text parameter describing the source of the login (only for reporting purposes).

scope string[]

List of space-delimited, case-sensitive strings representing the requested scope.

Optional if the fetchBasicProfile option is set to true and the profile, email, phone and openid scope values are allowed in client configuration.

fetchBasicProfile boolean

Fetch basic user profile information when they sign in. Automatically adds profile, email, phone and openid to the requested scope.

Defaults to true.

accessToken string

Access token of the current user. Enables social login linking to an existing account with a fresh token (less than 5 minutes old).

providerScope string

List of space-delimited, case-sensitive strings representing the requested scope at the social provider.

Defaults to the scope configured for the given provider in your ReachFive console.

Only for login with social provider.

requireRefreshToken boolean

If set to true, an OAuth 2.0 Refresh Token will be present in the token response.

Defaults to false.

Fetch user basic profile information when they sign in. Adds profile, email, phone and openid to the requested scope.

Refresh Tokens are only available with confidential Clients (with a configured authentication method) or for public Clients that enforce PKCE in the authorization code grant. The Refresh Token option must also be selected.

returnProviderToken boolean

Boolean that specifies whether you should return the provider access token.

Defaults to false.

If set to true, you retrieve the provider and provider access token as part of the authentication result.

captchaToken string

Pass along the response token you have received from reCAPTCHA. See Google’s documentation on how to obtain it.

Defaults to null.

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.

returnToAfterEmailConfirmation string

Returned in the redirectUrl as a query parameter, this parameter is used as the post-email confirmation URL.

This parameter should only be used with Hosted Pages.

saveCredentials boolean

Store the user credentials with the Credentials Management API.

Defaults to false.

This feature is experimental, please check your browser compatibility.

data SignupProfile

The data of the profile.

password string

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

email string

The primary email address 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.

customIdentifier string

A string that allows users to authenticate with something other than an email or phone_number. It’s important to note that an email and/or phone_number is still required to create a managed profile. Each custom_identifier value must be unique. The custom_identifier must be between 4-80 characters.

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 (generally 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).

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.

company string

The company’s name of the profile.

addresses List of ProfileAddress

The list of the profile’s postal addresses.

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 Record<string, any>

The custom fields of the profile.

consents Record<string, any>

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

Response

Type: Promise<AuthResult>

AuthResult object fields

Field Type Description

accessToken

string

The user’s newly-generated access token.

This a security token that gives access to authorized resources without further identification. It is represented as a JSON Web Token (JWT).

expiresIn

number

The lifetime of the access token (in seconds).

expiresIn always equals the access token lifetime set on your First-party Identity client in the ReachFive Console.

tokenType

string

The type of token that is issued.

This is always Bearer.

refreshToken

string

The user’s newly-generated refresh token.

A refresh token is not present unless you are implementing the refresh token grant. This is only possible when the offline_access scope is requested.

idToken

string

The user’s newly-generated ID token. This is a security token that contains authentication claims about the user. It is represented as a JSON Web Token (JWT).

Claims are pieces of information made about a particular subject.

For example, ID tokens might contain a claim called name that makes the claim that the name of the user authenticating is "Nicole Dubois".

{
    "sub": "987654321",
    "name": "Nicole Dubois",
    ...
}

idTokenPayload

JSON

The body of the ID token which outlines the claims. See ID token payload for more details.

For a full list of claims, check out the JWT Claims Registry.

code

string

The authorization code received from the initial authorization call.

state

string

An opaque value used to maintain state between the request and callback. The authorization server includes this value when redirecting the user-agent back to the client.

stepUpToken

string

The step up token needed to complete the stepup flow.

amr

string

The Authentication Method Reference (amr). When using MFA, the mfa value must be present.

For more on amr values, see here.

providerName

string

The name of the social login provider used to log in.

Example

kakaotalk

This is only relevant for SLO and is not included in the auth response for other flows.

providerAccessToken

string

The access token from the social login provider.

Example

ya29.a0AbV…​YGo9wg0174

This is only relevant for SLO and is not included in the auth response for other flows.

ID token payload

The possible claims to assert about an authenticated user are outlined in the table below.

Field Type Description

authType

string

The type of authentication used.

allowed values:
  • password

  • phone_number_password

  • magic_link

  • sms

  • external

  • refresh

  • login_as

  • third_party

  • webauthn

birthdate

string

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

email

string

The primary email address of the profile.

emailVerified

boolean

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

exp

number

The expiration time claim identifies the point in time (as a Unix timestamp) on or after which the JWT must not be accepted for processing.

Example
1704067201 # unix timestamp
Mon Jan 01 2024 00:00:01 GMT+0000 # corresponding actual date

familyName

string

The family name of the profile.

Also known as surname or last name.

givenName

string

The given name of the profile.

Also known as first name.

gender

string

The gender of the profile.

Currently allowed values are female, male and other.

iat

number

The time (as a Unix timestamp) at which the JWT was issued.

Example
1704067201 # unix timestamp
Mon Jan 01 2024 00:00:01 GMT+0000 # corresponding actual date

iss

string

The issuer claim identifies the principal that issued the JWT.

locale

string

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

name

string

The full name of the profile.

newUser

boolean

Whether the profile is new.

sub

string

The subject claim that identifies the profile.

picture

string

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

profile

string

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

updatedAt

string

The time the profile’s information was last updated.

auth_time

number

The time when end user authentication occurred. The time represents the first authentication of a given underlying session. This is represented as a Unix timestamp.

Example
1704067201 # unix timestamp
Mon Jan 01 2024 00:00:01 GMT+0000 # corresponding actual date