Launch the user view

AI Tools

In the previous section, we demonstrated how to create a session which returns a Session ID.

This Session ID is then used to build a client-side URL that launches the Yoti web client. The generated URL can be used in several ways:

  • As a hyperlink on your website
  • As a link shared securely with a user
  • Embedded within an iFrame on your webpage
  • Integrated using a WebView in your mobile app
  • Displayed as an encoded QR code

Hint: This is only intended for sessions where the user interface needs to be launched.

HTTP
Copy
URL ParameterDescription
sessionIdThe ID returned in the response when you create a Yoti AVS session.
sdkIdThe SDK ID for your application, provided by Yoti Hub.

Once the Yoti web client has launched, it will take the user through the age verification flow. The user will be redirected to the specified callback URL on completion of one of the age verification methods.

User View

User View

Iframe Implementation

The example below demonstrates the use of an iframe:

Markdown
Copy

Please note: allow="camera" is required when the age estimation or document scan methods are used.

While it is possible to use this solution in an iFrame, using a new browser window will guarantee an optimal user experience.

WebView Implementation

The examples below show how to use the session within a WebView for mobile apps:

React Native (iOS/Android)
Swift (iOS)
Kotlin (Android)
Copy

Note: Enabling inline media playback is necessary to allow the phone’s camera to open within the WebView, rather than in fullscreen mode.

Specific permissions must also be enabled to allow camera access and provide an optimal experience.

info.plist (iOS)
AndroidManifest.xml (Android)
Copy

QR Display

A QR code provides an alternative method for launching the Yoti AVS session. You can encode the session URL as a QR code and display it on a screen for users to scan with their mobile devices, which opens the web client in their browser. This allows customers to complete age verification securely on their own devices.

Before displaying the QR code, you should implement authentication to ensure the user is logged in or otherwise uniquely identified. In addition, you can also use the reference_id field in the Session payload to associate the AVS session with your unique user ID. This helps you track the session and tie results back to the correct user.

Alternatively, you can proxy the Yoti AVS Session URL behind your own service, allowing you to attach an auth cookie or token. This approach reduces the risk of the Session URL being forwarded or reused by someone else.

Important: Remember to subscribe to webhook notifications and track session results to update the user journey on the main screen as appropriate.

Below are some example code snippets. You may also use other libraries to generate the QR code.

JavaScript
React JS
Python
Java
PHP
Go
C#
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard