mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
Implement multi tenancy
This commit is contained in:
@@ -1,3 +1,13 @@
|
||||
import { fiefAuth } from "../../app/lib/fief";
|
||||
import { get } from "@vercel/edge-config";
|
||||
import { getFiefAuth } from "../../app/lib/fief";
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
export default fiefAuth.currentUser();
|
||||
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 });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user