2.1.1.2 Deep Link Method
Deep Link Method
The Deep Link Verification process allows users to verify their phone numbers by interacting with an external application, such as Telegram
or WhatsApp
, and then returning to your app to complete the verification.
Get started
- Setup Requirements: Follow the basic setup instructions.
- iOS Configuration: If using the deep link method, add
LSApplicationQueriesSchemes
to your app’sios/Info.plist
to enable external app linking.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>tg</string>
<string>whatsapp</string>
</array>
Initializing VerifySpeed
To start, initialize an instance of DeepLinkProcessor:
redirectToStore
(optional): Settrue
(default) to redirect users to the app store if Telegram or WhatsApp is not installed.
final deepLinkProcessor = VerifySpeed.instance.initializeDeepLinkProcessor(redirectToStore: true);
Verifying Phone Numbers with Deep Link
Use verifyPhoneNumberWithDeepLink
with these parameters:
deepLink
: URL that directs users to the external app for verification.verificationKey
: Unique key provided by your backend to ensure verification integrity.onSuccess
: Callback triggered on successful verification, returning atoken
to retrieve the user’s phone number.onFailure
: Callback triggered if verification fails, providingerror
details including type and message.
await deepLinkProcessor.verifyPhoneNumberWithDeepLink(
deepLink: 'DEEP_LINK', // deep link provided by your backend
verificationKey: 'VERIFICATION_KEY', // unique key provided by your backend
onSuccess: (token) {
log('token: $token');
},
onFailure: (error) {
log('error: ${error.message} type: ${error.type}');
},
);
Handling App Resumption
When users return from the external app, call notifyResumed
to complete the verification process and receive the token
from the onSuccess
callback.
await deepLinkProcessor.notifyResumed();
Example
For a complete implementation, see the example project on GitHub, and deep link section for more details.
When testing the example project, you'll need to integrate with your backend using these recommended request/response structures (which you can modify as needed).
Search for keywords TIP
if you want to know how to implement Deep Link Verification.