User Identification
Summary
This document describes and defines the three types of IDs. You can verify the ID process using the API or SDK.
What You'll Learn
In this document, you'll learn how to:
- Identify and Define User IDs
- Verify ID Process Using the API
- Verify ID Process Using the SDK
Types of IDs
There are three types of IDs:
- anonymous
- verified
- id.
They are in the Subject
JSON top-level object.
{ "Subject":
{"id":"xxxxxxx",
"verifiedId":"xxxxxxx",
"anonymousId":"xxxxxxx"
}
}
IDs Defined
The IDs as defined below are the following:
id | Unique record identifier, in uuid4 format. (uuid4 is an algorithm to generate a unique number of a specific length.) |
anonymousId | Are subjects who give consent or otherwise sign up without giving email. An id becomes verified when the subject (optionally) goes through the verification process explained below. |
verifiedId | Are people who have gone through the verification process, like clicking on an email to verify that. |
Verify ID Process Using the API
Here is the procedure to follow to verify subjects with a verifiedId.
Scope Required to Verify ID
You need
"scope" : "subject-profile-manage"
to verify an ID.Recall that you request scopes when you get an oAuth2 bearerToken:
params = { "grant_type" : "client_credentials", "scope" : "consent-insert-api consent-get-api subject-profile-manage" }
1. POST email to Profile
Then POST the email and profile to:
POST /subjects/profile
Use JSON like this. Note that the profile object is completely free-form. You can put any attributes you want.
{
"email": "[email protected]",
"profile": {
"age": 42,
"emailPreference": "none"
}
}
The computer responds with a code:
{'code': '022131'}
2. POST code to Profile
Then post this code plus the email used above to generate the verifiedId to:
POST /subjects/profile/verify
Using this JSON:
{
"email": "[email protected]",
"code": "022131"
}
The computer responds with the verifiedId.
{'verifiedId': '2C9wtJ22BdNjbh9AIHMy3jTfyMV'}
Verify ID Process Using the SDK
With the SDK, the code to create a validation token and verify the ID is below.
import { WireWheelSDK, Subject, Scopes, CreateConsentPayloadBuilder} from '@wirewheelio/cmp-javascript-sdk'
const scopes = ['consent-insert-api consent-get-api subject-profile-manage']
const accessToken = await WireWheelSDK.getToken(
{
issuer: process.env.issuerURL,
clientId: process.env.clientId,
clientSecret: process.env.clientSecret
},
scopes
)
const client = await WireWheelSDK.createClient({
token: accessToken,
apiUrl: 'https://api.upcp.wirewheel.io',
})
const vt = await client.createSubjectProfile({email: "[email protected]", "profile": {
"age": 42,
"emailPreference": "none"
}});
console.log("validation token=", vt);
const vf = await client.verifySubjectProfile({ email: "[email protected]", verificationCode: vt });
console.log("results", vf);
Responds with the token and the verifiedId
.
results 2CswOrEVVfO5jkzULssSPLv1TBR
Didn’t find what you were looking for?
Email our team: [email protected]?subject=UPCP
Updated 20 days ago