Skip to main content

Getting the stored data

import express from "express";
import { verifySession } from "supertokens-node/recipe/session/framework/express";
import UserMetadata from "supertokens-node/recipe/usermetadata";

let app = express();

app.post("/updateinfo", verifySession(), async (req, res) => {
const session = req.session;
const userId = session.getUserId();

const { metadata } = await UserMetadata.getUserMetadata(userId);

res.json({ preferences: metadata.preferences });
});
important

By default, all users have an empty metadata object.

Which frontend SDK do you use?
supertokens-web-js / mobile
supertokens-auth-react