OTPManager
@objc
public class OTPManager : NSObject
A singleton class for performing all the workflows related to OTP code sending and verification.
-
Request the server to send an OTP to the specified user. This API is deprecated.
Declaration
Swift
@available(*, deprecated, message: "Use requestOTP(recipient:recipientType:purpose:completion:﹚ instead") @objc public static func requestOTP(recipient: String, recipientType: IdType, purpose: OTPPurpose, isFutureUpdate: Bool = false, completion: @escaping (OTPSession?, NSError?) -> Void)
Parameters
recipient
The address the OTP should be sent to. Typically the user’s email address or mobile phone number.
recipientType
Recipient’s Id type.
purpose
he purpose of the OTP. See
OTPPurpose
for options.isFutureUpdate
This parameter is unused and will be ignored.
completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Request the server to send an OTP to the specified user. This api supports sending OTP for signup / onboarding purposes.
Declaration
Swift
@objc public static func requestOTP(recipient: String, recipientType: IdType, purpose: OTPPurpose, completion: @escaping (OTPSession?, NSError?) -> Void)
Parameters
recipient
The address the OTP should be sent to. Typically the user’s email address or mobile phone number.
recipientType
Recipient’s Id type.
purpose
he purpose of the OTP. See
OTPPurpose
for options.completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Request the server to send an OTP to the specified user. This API is deprecated & does not support sending OTP for signup / onboarding purposes.
Declaration
Swift
@available(*, deprecated, message: "Use requestOTP(recipient:recipientType:purpose:completion:﹚ instead") @objc public static func requestOTP(recipient: String, purpose: OTPPurpose, completion: @escaping (OTPSession?, NSError?) -> Void)
Parameters
recipient
The address the OTP should be sent to. Typically the user’s email address or mobile phone number.
purpose
The purpose of the OTP. See
OTPPurpose
for options.completion
Block that will be called once sending is completed. The block will provide an error object if something went wrong.
-
Verify an OTP code sent to user with the server.
Declaration
Swift
@available(*, deprecated, message: "Use verifyOTP(code:purpose:session:recipient:recipientType:completion:﹚ instead") @objc public static func verifyOTP(code: String, purpose: OTPPurpose, session: String = "", completion: @escaping (OTPSession?, NSError?) -> Void)
Parameters
code
The one time password code sent to the user.
purpose
The purpose of the OTP. See
OTPPurpose
for options.session
The session ID for the OTP.
completion
Block that will be called once verification is completed. The block will provide an OTPSession object for purposes like
.forgotPassword
to be used with subsequent calls of setting a new password. The block will also provide an error object if verification fails. -
Verify an OTP code sent to user with the server. This API is deprecated.
Declaration
Swift
@available(*, deprecated, message: "Use verifyOTP(code:purpose:session:recipient:recipientType:completion:﹚ instead") @objc public static func verifyOTP(code: String, purpose: OTPPurpose, session: String = "", recipient: String, recipientType: IdType, isFutureUpdate: Bool = false, completion: @escaping (OTPSession?, NSError?) -> Void)
Parameters
code
The one time password code sent to the user.
purpose
The purpose of the OTP. See
OTPPurpose
for options.session
The session ID for the OTP.
recipient
The destination for OTP e.g email address, mobile number, vin.
recipientType
The type of value used in recipient parameter. Refer to
IdType
.isFutureUpdate
This parameter is unused and will be ignored.
completion
Block that will be called once verification is completed. The block will provide an OTPSession object for purposes like
.forgotPassword
to be used with subsequent calls of setting a new password. The block will also provide an error object if verification fails. -
Verify an OTP code sent to user with the server.
Declaration
Swift
@objc public static func verifyOTP(code: String, purpose: OTPPurpose, session: String = "", recipient: String, recipientType: IdType, completion: @escaping (OTPSession?, NSError?) -> Void)
Parameters
code
The one time password code sent to the user.
purpose
The purpose of the OTP. See
OTPPurpose
for options.session
The session ID for the OTP.
recipient
The destination for OTP e.g email address, mobile number, vin.
recipientType
The type of value used in recipient parameter. Refer to
IdType
.completion
Block that will be called once verification is completed. The block will provide an OTPSession object for purposes like
.forgotPassword
to be used with subsequent calls of setting a new password. The block will also provide an error object if verification fails.