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();"/updateinfo", verifySession(), async (req, res) => {
const session = req.session;
const userId = session.getUserId();

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

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

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