WireWheel's CMP Javascript SDK
WireWheel Consent Management Platform JavaScript SDK
Getting started
Getting an access token
In order to talk to our API you will need an access token. Since the client ID and client secret are required to issue a token, this call must be performed from a backend service.
import { WireWheelSDK, Scopes } from '@wirewheelio/cmp-javascript-sdk'
const scopes = [Scopes.ConsentWrite]
const accessToken = await WireWheelSDK.getToken(
{
/** URL of authorization services provider */
issuer: string,
/** The client_id is the public identifier of your app */
clientId: string,
/** The client_secret is a secret known only to the application and the authorization server. */
clientSecret: string,
},
scopes
)
Creating a Consent
The WireWheelClient can be used from a browser or node environment. You need an access token to instantiate it.
import { WireWheelSDK, Subject, ActionType } from '@wirewheelio/cmp-javascript-sdk'
const client = WireWheelSDK.createClient({
token: accessToken,
apiUrl: 'https://api.demo.upcp.wirewheel.io',
})
// Example with anonymous Subject
await client.createConsent({
tags: ['marvel', 'movies'],
actions: [{ target: 'navigation-system', vendor: 'general-vendor', action: ActionType.Accept }]
attributes: [{platform: 'Linux x86_64'}],
subject: Subject.verified('a-unique-id-of-this-subject')
})