Skip to content

4. User JWT

TON Play edited this page May 31, 2024 · 6 revisions

Get JWT

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

Decode JWT

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

  1. Visit jwt.io
  2. Paste your JWT into the Encoded field

example decoded jwt

You can check all available libraries to work with JWT token here.

Validate User JWT

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

Clone this wiki locally