mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
13 lines
480 B
TypeScript
13 lines
480 B
TypeScript
import { getFiefAuth } from "../../app/lib/fief";
|
|
import { NextApiRequest, NextApiResponse } from "next";
|
|
|
|
export default async (req: NextApiRequest, res: NextApiResponse<any>) => {
|
|
const fromUrl = req.headers["referer"] && new URL(req.headers["referer"]);
|
|
const fief = fromUrl && (await getFiefAuth(fromUrl));
|
|
if (fief) {
|
|
return fief.currentUser()(req as any, res as any);
|
|
} else {
|
|
return res.status(200).json({ userinfo: null, access_token_info: null });
|
|
}
|
|
};
|