Skip to main content

Reading roles in an API

To do this, you must simply read the access token's payload post session verification using the getAccessTokenPayload function:

let { verifySession } = require("supertokens-node/recipe/session/framework/express");
app.post("/update-blog", verifySession(), async (req, res) => {
    // The key "role" is used here since we used that    // while setting the access token payload     let role = req.session.getAccessTokenPayload()["role"]
    //....});