โฑ๏ธ Quickstart
Library
This example integration uses JavaScript.
1. Start the Validation Flow.โ
Place this code on your website to show a validation button that starts the validation process. Get your platform credentials by creating a developer account for free in the developer console.
<script src="https://developers.trustedaccounts.org/sdk/v1/trusted-accounts-sdk-js.js"></script>
<button id="trusted-button">I am human</button>
<script>
const email = 'foo@bar.com'; // The email of the user you want to validate
const trustedClient = new TrustedAccountsClient(
"CLIENT_ID", // Your Client ID
"REDIRECT_URL" // Your Redirect URI
);
document.getElementById("trusted-button").addEventListener("click",async()=>{let e=trustedClient.generateVerificationLink(email);window.location.href=e});
</script>
2. Handle the Callbackโ
After the user completes the verification, they will be redirected back to your redirect URL. Place this code on your website at this url to handle this callback and get the Trusted ID.
<script src="https://developers.trustedaccounts.org/sdk/v1/trusted-accounts-sdk-js.js"></script>
<p id="trusted-message">Loading...</p>
<script>
window.onload = async () => {
const trustedId = await new TrustedAccountsClient(null, null).handleCallback(window.location.href);
document.getElementById('trusted-message').innerText = `Success! Verified Trusted ID: ${trustedId}`;
};
</script>
That's it! You have successfully integrated Trusted Accounts on your platform! ๐ Now click the button on your website, validate yourself and then go to the user list in the developer console to find the newly validated user.