Skip to main content

If you are using our backend SDK that is lesser than the following versions, please visit the older documentation link here.

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 versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI