iOS

Use an ASWebAuthenticationSession to launch CLEAR's UI in your iOS app

Before beginning a web app implementation ensure you have your credentials and review the appropriate steps in your specific Integration Methods guide.

Overview

Launch the verification UI in an ASWebAuthenticationSession and handle the results at the redirect URL.

🚧

Note on WebViews

Clear requires our partners to invoke the WebView as a ASWebAuthenticationSession safariViewController CLEAR blocks non secure WkWebviews and iFrames in production as it is a security concern. For more information, please contact your dedicated CLEAR point of contact.

Define a redirect

To have the user navigated back to your app when the verification is complete a redirect_url must be properly defined. The redirect_url field is used to create a verification_session and ASWebAuthenticationSession.

Also, make sure that the redirect_url is correctly registered in the app's Info.plist under URL schemes.

redirect_url syntax for iOS

LocationKeyValue
Info.plistURL Types > URL Schemesmyapp://
VerificationSessionredirect_urlmyapp://auth
ASWebAuthenticationSessioncallbackURLSchememyapp

Launch ASWebAuthenticationSession

To launch the ASWebAuthenticationSession, you'll first need the token from step 1 to construct a URL with the token as a query parameter: https://verified.clearme.com/verify/?token=<VERIFICATION_TOKEN>. Pass that URL to the ASWebAuthenticationSession.

Handle redirects

When the user successfully completes the verification, the UI will redirect to the redirect_url you specified when you created the VerificationSession.

✍️

Note on redirects

Not all users who are redirected are verified. A successful redirect does not equate a successful verification. You will still need to retrieve the verification using the /v1/verification_sessions/{id} endpoint from your backend after the redirect to know if a user is verified.

Testing the user flow

The user flow initially begins in CLEAR's sandbox environment where all data returned is mocked.

To test with CLEAR's sandbox mode, use your sandbox API key. Verification sessions created in sandbox mode don't send OTPs or validate data entered.

Controlling the UI in sandbox mode is easy; just enter 123456 into the OTP input box or use the Demo/Testing Tools at the bottom of the UI to "Skip" the steps.

To see a return user flow, open a new verification session link and input the magic number +1-408-222-2222 and flow the same steps as listed above.


What’s Next

After defining where end users will verify, configure a project to customize your verification needs

Did this page help you?