-
Notifications
You must be signed in to change notification settings - Fork 8
4. User JWT
TON Play edited this page May 31, 2024
·
6 revisions
You can get a user token using the method:
getToken: () => { token: token }
// This method allows you to get user JWT token
const { parent } = window;
parent.postMessage({ playdeck: { method: 'getToken' } }, '*');
window.addEventListener('message', ({ data }) => {
const playdeck = data?.playdeck;
if (!playdeck) return;
if (playdeck.method === 'getToken') {
console.log(playdeck.value); // { token: '123456789...' }
}
});
More information about the interaction with our platform is written on the Integration guide
JWT is an encoded JSON, so you can easily decode it. Many libraries allow you to do so, or you can check it manually via jwt.io
- Visit jwt.io
- Paste your JWT into the Encoded field
You can check all available libraries to work with JWT token here.
This method allows to verify if a User JWT token is valid or not.
POST https://api.playdeck.io/api/v1/oauth/check?token={UserJWT}
200: OK
{
"valid": false,
"active": false,
"userUid": null
}
For server side validation you can use this public key download