signup
client.signup( profile, redirectUrl, success, failure, // Optional arguments scope )
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 if the SMS feature is enabled.
Examples
import com.reach5.identity.sdk.core.ReachFive
import com.reach5.identity.sdk.core.models.ProfileSignupRequest
import com.reach5.identity.sdk.core.models.SignupResponse
client.signup(
profile = ProfileSignupRequest(
givenName = "John",
familyName = "Doe",
gender = "male",
email = "john.doe@gmail.com",
customIdentifier = "coolCat55",
password = "hjk90wxc"
),
scope = listOf("openid", "profile", "email"),
success = { response ->
when (response) {
is SignupResponse.AchievedLogin(authToken) -> {
// Signup succeeded and the user is logged in
// Handle authenticated session
}
is SignupResponse.AwaitingIdentifierVerification -> {
// Signup succeeded but requires email verification before login
// Prompt the user to verify their email
}
}
},
failure = { error ->
// Handle a ReachFive error
}
)
import com.reach5.identity.sdk.core.ReachFive
import com.reach5.identity.sdk.core.models.ProfileSignupRequest
import com.reach5.identity.sdk.core.models.SignupResponse
client.signup(
profile = ProfileSignupRequest(
givenName = "John",
familyName = "Doe",
gender = "male",
phoneNumber = "+353875551234",
customIdentifier = "coolCat55",
password = "hjk90wxc"
),
scope = listOf("openid", "profile", "phone"),
success = { response ->
when (response) {
is SignupResponse.AchievedLogin -> {
// Signup succeeded and the user is logged in
// Handle authenticated session
}
is SignupResponse.AwaitingIdentifierVerification -> {
// Signup succeeded but requires phone number verification before login
// Prompt the user to verify their phone number
}
}
},
failure = { error ->
// Handle a ReachFive error
}
)
import com.reach5.identity.sdk.core.models.Profile
client.signup(
profile = ProfileSignupRequest(
givenName = "John",
familyName = "Doe",
gender = "male",
email = "john.doe@gmail.com",
customIdentifier = "coolCat55",
password = "hjk90wxc"
),
scope = listOf("openid", "profile", "email"),
success = { authToken -> ... }, // Get the profile's authentication token
failure = { error -> ... } // Handle a ReachFive error
)
Parameters
The data of the profile.
|
|||||||||||||||||||||||||||||||||||||||||
The URL sent in the email to which the user is redirected. This URL must be whitelisted in the |
|||||||||||||||||||||||||||||||||||||||||
List of space-delimited, case-sensitive strings representing the requested scope. Default scopes are the allowed scopes set up in the client’s configuration. |
|||||||||||||||||||||||||||||||||||||||||
Callback called once the signup process completes.
You receive a
|
|||||||||||||||||||||||||||||||||||||||||
Callback called once the request has failed. You’ll get a |
Response
-
Type: SignupResponse.AchievedLogin(authToken) | AwaitingIdentifierVerification
-
Error: ReachFiveError
Depending on the feature configuration and the user’s verification status, the response can contain an authentication token or indicate that verification is required before login.
AchievedLogin
Returns the authentication token.
idToken |
The ID token JSON Web Token (JWT) that contains the profile’s information. Only available when the |
||||||||||||||||||||||||||||||||||
accessToken |
The authorization credential JSON Web Token (JWT) used to access the ReachFive API. |
||||||||||||||||||||||||||||||||||
refreshToken |
The refresh token JSON Web Token (JWT) used to obtain new access tokens once they expire. Only available when the |
||||||||||||||||||||||||||||||||||
tokenType |
The type of token. Always equal to |
||||||||||||||||||||||||||||||||||
expiresIn |
The lifetime in seconds of the access token. If |
||||||||||||||||||||||||||||||||||
user OpenIDUser |
The user’s information contained in the ID token.
|
AwaitingIdentifierVerification
Returned when a signup completes but the user must verify their identifier (email or phone) before logging in.
-
No
AuthTokenis returned. -
You should prompt the user to check their email or SMS for verification instructions.
-
After verification, the user can log in normally to receive an
AuthToken.
ReachFiveError
message |
The message of the error. |
||||||||||||||
getErrorCode() |
The error code’s enumeration value. |
||||||||||||||
code |
The HTTP status code or SDK error code. See Android SDK errors for more details. |
||||||||||||||
exception |
The stack trace of the error. |
||||||||||||||
data |
Additional data about the error.
|