verifyEmail
Description
Confirms the user’s email address using the provided verification code. This method is called after the user receives the verification email and inputs the code.
If successful, the email is marked as verified in the user’s profile.
|
Examples
import Reach5
let profileAuthToken: AuthToken = // Here paste the authorization token of the profile retrieved after login
AppDelegate
.reachfive()
.verifyEmail(
authToken: profileAuthToken,
email: "johnatthan.doe@gmail.com",
code: "123456"
)
.onSuccess { _ in
// Successfully verified email
}
.onFailure { error in
// Return a ReachFive error
}
Parameters
Parameter | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Authorization token of the profile retrieved from login.
|
|||||||||||||
The verification code sent to the user. |
|||||||||||||
The email address of the profile. |
Response
Type: Future<Void, ReachFiveError>
If verified, the response indicates "Successfully verified email". If the email is already verified, the response indicates "Email already verified".
The promise is rejected and returns a ReachFiveError
if:
-
The parameters are invalid.
-
The verification code is incorrect or expired.
ReachFiveError
Based on the problem, the ReachFiveError
will be:
-
AuthCanceled
: The user cancelled the request or no credential was available in the keychain. -
RequestError(apiError: ApiError)
for a Bad Request (status 400) error. -
AuthFailure(reason: String, apiError: ApiError?)
mainly for Unauthorized (status 401) error. -
TechnicalError(reason: String, apiError: ApiError?)
if it’s an Internal Server Error (status 500) or other internal errors.
ApiError
error |
The main error message. |
||||||
errorId |
The identifier of the error. |
||||||
errorUserMsg |
The user-friendly error message.
|
||||||
errorMessageKey |
The error message key. |
||||||
errorDescription |
The technical error message. |
||||||
errorDetails FieldError[] |
|