Setting Up Cross Device Consent Using the Cross Device Consent API
You can set up cross device consent using the Highly Available Cross Device Consent API, allowing you to retrieve information about data subjects' consent preferences and the data elements associated with them. The API also bypasses standard API limits and is optimized for a reduced response time.
Setting Up the API Request
The Cross Device Consent API uses the https://consent-api.onetrust.com/v1/preferences endpoint and makes a GET call to get a list of data subjects' preferences and data elements.
The host stays the same regardless of the OneTrust environment.
|
Request Headers |
Description |
Example |
|---|---|---|
|
Identifier |
Data subject identifier found in the OneTrust UI or API. |
Email address, phone number, UUID |
|
TenantId |
The ID of your application's environment. |
This value can be found in the application by clicking on the Help icon |
|
Authorization |
When configuring the call in a workflow, a JWT token needs to be dynamically created for each data subject. |
For more information, see Step 2: Construct JWT Token. |
Setting Up the Authorization Header
Step 1: Store the Public Key in OneTrust
-
Click the gear icon
in the right hand corner to access Global Settings.
-
On the Global Settings menu, select . The Public Keys screen appears.
Note:The Public key must be generated based on supported algorithms.
-
The Public Key field in the OneTrust application is the same value as the secret key used when constructing the JWT token.
-
Key ID is optional if only one public key will be used, but required if managing multiple keys.
Step 2: Construct JWT Token
After adding the public key, a JWT token will need to be dynamically constructed for each given data subject.
HS256 Algorithm sample JWT to decode, which can be copied and pasted into jwt.io: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IkhBIEFQSSJ9.eyJzdWIiOiJqb2huZG9lQG9uZXRydXN0LmNvbSJ9.9IowxQDufcf_uXpIQ_zO9svzsGuAi9BoOeSfEx-2byc
- Field
- Description
- kid (Optional)
-
If used, as referenced above, the value is setup in OneTrust when adding a public key.
- sub
-
Data Subject Identifier
- your-256-bit-secret
-
The public key value stored in OneTrust as generated earlier with the allkeysgenerator.
-
JWT tokens can be dynamically generated in a workflow by using one of the JWT libraries available on https://jwt.io/libraries.
-
Pass the encoded JWT into the header as Authorization: Bearer {JWT}.