Appearance
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 β
- Be registered on our Webmasters Platform as a webmaster, available at https://webmasters.ageverif.com.
- Have one or more websites registered on the platform: https://webmasters.ageverif.com/website/add.
- Have AgeVerif Checker Script (SDK) installed on both websites.
Custom integration is also possible without scripts, via API. Click here to learn more.
- Be familiar with HTML (JavaScript is optional).
High-Level Example β
A new visitor enters your Website A running AgeVerif Checker Script.
They go through the verification process, guaranteeing they are an adult.
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.The Checker appends the Portable Verification to the URL and redirects the visitor to Website B.
httphttps://example.org?agvf=eyJ0eXAiOiJKV1Qi...Now on Website B, also running the Checker Script, the Portable Verification is automatically detected and validated.
That's it! The visitor is now verified on both websites without having to go through the age verification process again.
Integrations β
Checker Script Easy
Use your existing Checker Script to enable portable verifications across multiple websites.REST API Custom
Use the REST API (OAuth2) to verify and generate portable verifications without scripts.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
}): voidRedirects 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 β
| Field | Type | Format | Description |
|---|---|---|---|
| url | string | E.g. https://example.org | The URL to redirect to |
| target | string (optional) | E.g. _blankDefault: _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 β
| Field | Type | Format | Description |
|---|---|---|---|
| url | string | E.g. https://example.org | The 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/tokenHeaders β
| Field | Format | Description |
|---|---|---|
| Authorization | E.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
| Field | Type | Format | Description |
|---|---|---|---|
| grant_type | string | portable_verification | Use portable_verification to exchange it for an access token.@see OAuth2 page for all supported grant_types. |
| portable_verification | string | E.g. eyJ0eXAiOiJKV1Qi... | The Portable Verification token obtained (usually from the URL parameter agvf). |
| visitor_ip | string | E.g. 1.1.1.1 | Visitor'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>,
}| Field | Type | Format | Description |
|---|---|---|---|
| token_type | string | Bearer | Hint for how token should be used. Only Bearer is available |
| access_token | string | E.g. eyJ0eXAiOiJKV1Qi... | Used to fetch user data on Resources endpoint |
| expires_at | integer | E.g. 781045200 | Unix timestamp when the token expires |
| expires_in | integer | E.g. 3600 | Seconds until token expires |
Example β
Your website receives a Portable Verification token from the visitor as a URL parameter:
agvf.httphttps://example.org/?agvf=eyJ0eXAiOiJKV1Qi...You send an authenticated server-side request with the
portable_verificationtoken:bashcurl -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, }You receive an
access_tokenand can now use it to request visitor resources.The
access_tokenobtained 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/resourcesCheck the OAuth2 Resources Endpoint for more details on all available visitor resources.
Headers β
| Field | Format | Description |
|---|---|---|
| Authorization | E.g. Bearer eyJ0eXAiOiJKV1Qi... | access_token obtained from the Token Endpoint |
Parameters β
| Field | Type | Format | Description |
|---|---|---|---|
| resources | string[] | portable_verification | Array with visitor resources to return. Use portable_verification to generate a new Portable Verification token. |
| visitor_ip | string | E.g. 1.1.1.1 | Visitor'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:
| Field | Type | Format | Description |
|---|---|---|---|
| portable_verification | object | Object containing the Portable Verification token and its metadata | |
| > token | string | E.g. eyJ0eXAiOiJKV1Qi... | Newly generated Portable Verification token, unique and single-use |
| > expires_at | integer | E.g. 781045200 | Unix timestamp when the token expires |
| > expires_in | integer | E.g. 3600 | Time in seconds until the token expires |
Example β
You send an authenticated server-side request to the Resources endpoint with the
access_tokenobtained from the OAuth2 token endpoint:bashcurl -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 } } }You append the received
portable_verificationtoken to external links as a URL parameteragvf.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 β
Requirements β
- Have AgeVerif Checker Script (SDK) installed on your website.
- Have AgeGO challenge enabled in the Webmasters Platform
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.
