|
|
|
|
|
- Operating mode
- Implementing automatic verification by SMS
- Special cases
SMSDetectOneTimeCode (Function) In french: SMSDétecteCodeUsageUnique Automatically populates an Edit control with a one-time code received by SMS.
IF SMSDetectOneTimeCode(OnOneTimeCodeReceived) THEN
PROGBAR_WAIT_CODE.Visible = True
ELSE
Error()
END
PROCEDURE OnOneTimeCodeReceived(sCode is string)
EDT_Code = sCode
PROGBAR_WAIT_CODE.Visible = False
VerifyCode()
Syntax
<Result> = SMSDetectOneTimeCode(<WLanguage procedure>)
<Result>: Boolean - if detection has been started,
- False otherwise.
<WLanguage procedure>: Procedure name Name of the WLanguage procedure ("callback") called when the code is received. This procedure has the following format:
PROCEDURE <Procedure name>(<Code received>) where <Code received> is a string that contains the code received by SMS (or an empty string if an error occurs). If an error occurs, ErrorInfo can be used to retrieve the error message. Remarks Operating mode SMSDetectOneTimeCode starts listening for incoming SMS messages for 5 minutes. If an SMS containing a one-time code is received during this period, the procedure passed to the function is automatically executed using the received code as a parameter, and detection is stopped. The SMS containing the one-time code must meet the following criteria: - it must not exceed 140 bytes.
- it must contain a one-time code. This code must be a sequence of 4 to 10 digits (at least 6 characters recommended), without separators.
- it must end with an 11-character string identifying your application.
Example: Authentication code: 123456 HQ+6aVM7NXq Note: The string at the end of the SMS is a hash string composed of the following elements: - the application package's name.
- the application's public key certificate.
You can find this string in the Android generation wizard when SMSDetectOneTimeCode is used in the code of the application. You can also generate this string with the keytool command. For more details, see Keytool command. Implementing automatic verification by SMS Implementing automatic SMS verification in a mobile application requires backend processes to verify the user's identity, send the SMS and check the one-time code when it is sent back to the server to perform all the necessary post-verification tasks. There is no specific way to establish communication between the mobile application and the server. One possible solution is to expose a REST API with two endpoints: - one that receives verification requests with the user details and sends the SMS messages in the expected format
- one that receives the one-time code received by the application for further processing.
To generate an SMS one-time code, it's recommended to generate a sequence of 6 to 10 random digits, store it in a database table and associate it with a user ID and an expiration date. Special cases - If SMSDetectOneTimeCode is called while detection is already in progress, the call will be ignored and the function will return False.
- You can get the phone number(s) of the current user with tapiGetNumber.
- SMSDetectOneTimeCode has no effect in the simulator.
- SMSDetectOneTimeCode must be called in the main thread, and only when the application is in the foreground.
Business / UI classification: Neutral code Component: wd300android.aar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|