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.

Looking for older version of the documentation?
Which UI do you use?
Custom UI
Pre built UI