Skip to content

Portable Verifications (Cross-Site) ​

AgeVerif provides a Portable Verification system, automatically allowing visitors across multiple websites without requiring them to go through the age verification process again.

The Portable Verification is cryptographically signed and is automatically verified by any website running the AgeVerif Checker Script.

🀡 Who is this for?

This feature is especially useful for webmasters with multiple websites or for networks of affiliated sites that want to streamline the age verification process for their visitors.

πŸ” Privacy-first. Always.

No personal information is shared about the user or origin website. The token is tamper-proof, single-use, non-shareable and valid for a limited time.

Requirements ​

High-Level Example ​

  1. A new visitor enters your Website A running AgeVerif Checker Script.

  2. They go through the verification process, guaranteeing they are an adult.

  3. The visitor clicks on a link to Website B.

    You can use the JavaScript function ageverif.redirect(url) or the data attribute <a data-agvf /> for external links.

  4. The Checker appends the Portable Verification to the URL and redirects the visitor to Website B.

    http
    https://example.org?agvf=eyJ0eXAiOiJKV1Qi...
  5. Now on Website B, also running the Checker Script, the Portable Verification is automatically detected and validated.

  6. That's it! The visitor is now verified on both websites without having to go through the age verification process again.

Integrations ​

Checker Script Integration ​

If you already use AgeVerif Checker on your website, you're one step away from sharing Portable Verifications to other websites.

Otherwise, please implement the Checker Script on your website and come back to this guide.

βœ… You can already receive Portable Verifications

If you are using the Checker Script, it will automatically receive and validate Portable Verifications without any additional setup.

DOM data attribute ​

You can turn any anchor element <a> into a Portable Verification link by adding the data-agvf attribute.

Doing so will automatically append the Portable Verification token to the URL when the link is clicked.

Example ​

html
<a href="https://example.org?utm_source=xyz" target="_blank" data-agvf>Visit Example</a>

The browser will open a new tab to the following URL:

http
https://example.org?utm_source=xyz&agvf=<portable_verification>

The destination website will then handle the Portable Verification token (agvf) and auto-verify the visitor accordingly.

βœ… Works with dynamic elements added to the DOM after the initial page load.

JavaScript API ​

Handle Portable Verifications through the JavaScript API, available on the global ageverif object or window.ageverif.

πŸ” Looking for the full API?

Check out the Checker Script JavaScript API for a full list of available functions and usage examples.


redirect() ​

ts
redirect(url: string, {
  target?: string
}): void

Redirects the visitor to the specified URL, appending the Portable Verification token if available.

Can navigate in the same page or open a new tab depending on the target parameter.

πŸ”ž What if the visitor is NOT verified?

The visitor will be redirected to the specified URL as-is, without the Portable Verification.

Parameters ​

FieldTypeFormatDescription
url stringE.g. https://example.orgThe URL to redirect to
targetstring
(optional)
E.g. _blank
Default: _self
The target window or frame for the redirection

Example ​

html
<button onclick="ageverif.redirect('https://example.org', { target: '_blank' })">Visit Example</button>

getRedirectUrl() ​

ts
async getRedirectUrl(url: string): Promise<string>

Generates a Portable Verification and appends it to the given URL, used to redirect the user accordingly.

Parameters ​

FieldTypeFormatDescription
url stringE.g. https://example.orgThe URL to redirect to

Returns ​

A promise with the given URL appended with the Portable Verification token if available.

Example ​

ts
const url = await ageverif.getRedirectUrl('https://example.org?utm_source=xyz');
// https://example.org?utm_source=xyz&agvf=eyJ0eXAiOiJKV1Qi...

getPortableVerification() ​

ts
async getPortableVerification(): Promise<string>

Generates a Portable Verification token.

Throws an error if the visitor is not verified or if the Portable Verification cannot be generated.

Returns ​

A promise with the Portable Verification token as a string, or null if the visitor is not verified.

Example ​

ts
const token = await ageverif.getPortableVerification();
// eyJ0eXAiOiJKV1Qi...

REST API Integration ​

The REST API follows the OAuth2 Protocol and allows websites to verify and generate Portable Verifications tokens without using the Checker Script (SDK).

These tokens usually come in through the URL parameter agvf like this:

http
https://example.org?agvf=eyJ0eXAiOiJKV1Qi...

Requirements ​

⚠ Read the OAuth2 documentation carefully before proceeding

You must read the OAuth2 Documentation before proceeding with this integration.

  • Enable the AgeVerif OAuth2 feature on your website, obtaining a Client ID and Client Secret.
  • Be familiar with OAuth2 protocol to correctly implement it in their application.

Verify Portable Verifications ​

To verify a Portable Verification token, you must exchange it for an access_token from the API.

http
POST https://api.ageverif.com/v1/oauth2/token

Headers ​

FieldFormatDescription
AuthorizationE.g. Basic <base64(client_id:client_secret)>Basic authentication header with your OAuth2 Live Client ID and Client Secret, found in the Webmasters Platform

Information about Basic Access Authorization can be found here.

Parameters ​

Content-Type: application/x-www-form-urlencoded

FieldTypeFormatDescription
grant_type stringportable_verificationUse portable_verification to exchange it for an access token.
@see OAuth2 page for all supported grant_types.
portable_verificationstringE.g. eyJ0eXAiOiJKV1Qi...The Portable Verification token obtained (usually from the URL parameter agvf).
visitor_ip stringE.g. 1.1.1.1Visitor's IP address (v4/v6), rightful bearer of the Portable Verification token.

Client Authentication

You can authenticate either by Authorization header or by sending client_id and client_secret as parameters in the request body.

Response ​

The response contains an access_token and a token_type used in the OAuth2 Resources endpoint.

Content-Type: application/json

🟒 200 OK

json
{
  "token_type": "Bearer",
  "access_token": <access_token>,
  "expires_at": <expires_at>,
  "expires_in": <expires_in>,
}
FieldTypeFormatDescription
token_type stringBearerHint for how token should be used. Only Bearer is available
access_tokenstringE.g. eyJ0eXAiOiJKV1Qi...Used to fetch user data on Resources endpoint
expires_at integerE.g. 781045200Unix timestamp when the token expires
expires_in integerE.g. 3600Seconds until token expires

Example ​

  1. Your website receives a Portable Verification token from the visitor as a URL parameter: agvf.

    http
    https://example.org/?agvf=eyJ0eXAiOiJKV1Qi...
  2. You send an authenticated server-side request with the portable_verification token:

    bash
    curl -X POST https://api.ageverif.com/v1/oauth2/token \
      -H "Authorization: Basic V61LHMuuwahgYDcGnPC5bbWobLw7BzR..." \
      -H "Content-Type: application/x-www-form-urlencoded" \
      -d "grant_type=portable_verification" \
      -d "portable_verification=eyJ0eXAiOiJKV1Qi..." \
      -d "visitor_ip=1.1.1.1"

    Response:

    json
    {
      "token_type": "Bearer",
      "access_token": "eyJ0eXAiOiJKV1Qi...",
      "expires_at": 781045200,
      "expires_in": 3600,
    }
  3. You receive an access_token and can now use it to request visitor resources.

    The access_token obtained is interchangeable with any other access token obtained through the OAuth2 Resources Endpoint.

⏱ Portable Verifications are single-use

Once a Portable Verification token is verified and exchanged for an access_token, it cannot be exchanged again.

You can use the access_token multiple times to request visitor resources from the resources endpoint.

Generate a Portable Verification ​

You can use any access_token obtained from the OAuth2 Token Endpoint to generate a new Portable Verification token or request visitor resources.

http
GET https://api.ageverif.com/v1/oauth2/resources

Check the OAuth2 Resources Endpoint for more details on all available visitor resources.

Headers ​

FieldFormatDescription
AuthorizationE.g. Bearer eyJ0eXAiOiJKV1Qi...access_token obtained from the Token Endpoint

Parameters ​

FieldTypeFormatDescription
resources string[]portable_verificationArray with visitor resources to return.
Use portable_verification to generate a new Portable Verification token.
visitor_ipstringE.g. 1.1.1.1Visitor's IP address (v4/v6). Used to prevent abuse and sharing.

Response ​

🟒 200 OK

json
{
  "resources": {
    "portable_verification": {
      "token": <token>,
      "expires_at": <expires_at>,
      "expires_in": <expires_in>
    }
  }
}

Resources:

FieldTypeFormatDescription
portable_verification objectObject containing the Portable Verification token and its metadata
> token stringE.g. eyJ0eXAiOiJKV1Qi...Newly generated Portable Verification token, unique and single-use
> expires_at integerE.g. 781045200Unix timestamp when the token expires
> expires_in integerE.g. 3600Time in seconds until the token expires

Example ​

  1. You send an authenticated server-side request to the Resources endpoint with the access_token obtained from the OAuth2 token endpoint:

    bash
    curl -X GET https://api.ageverif.com/v1/oauth2/resources \
      -H "Authorization: Bearer eyJ0eXAiOiJKV1Qi..." \
      -H "Content-Type: application/x-www-form-urlencoded" \
      -d "resources=portable_verification" \
      -d "visitor_ip=1.1.1.1"

    Response:

    json
    {
      "resources": {
        "portable_verification": {
          "token": "eyJ0eXAiOiJKV1Qi...",
          "expires_at": 781045200,
          "expires_in": 3600
        }
      }
    }
  2. You append the received portable_verification token to external links as a URL parameter agvf.

    html
    <a href="https://external.example.com/some-page?agvf=eyJ0eXAiOiJKV1Qi...">Link to external page</a>

Third Party ​

We also support and exchange age verification tokens with select third-parties.

AgeGO ​

www.agego.com

Requirements ​

Features ​

  • βœ… Receive AgeGO "Cross-Site Verification" tokens and decode them automatically
  • ❌ Cannot generate AgeGO tokens for external websites

πŸ’³ This challenge is paid

Each successful verification token exchange will incur a fee. Check our pricing for more details.

Check out the AgeGO documentation for more details on how to generate and send AgeGO tokens.

Last updated: