next.js/examples/with-magic/pages/api/user.js
user.js10 lines387 B
import { getLoginSession } from "../../lib/auth";

export default async function user(req, res) {
  const session = await getLoginSession(req);
  // After getting the session you may want to fetch for the user instead
  // of sending the session's payload directly, this example doesn't have a DB
  // so it won't matter in this case
  res.status(200).json({ user: session || null });
}
Quest for Codev2.0.0
/
SIGN IN