supertokens.init({
framework: "express",
supertokens: {
connectionURI:
"https://st-dev-369838c0-b579-11ee-99f9-f340bd017302.aws.supertokens.io",
apiKey: "WIyZf2oKVE-z7qRJR4Xe0ngH6A",
},
appInfo: {
appName: "SassySpy",
apiDomain:
process.env.NODE_ENV === "dev"
? "http://localhost:5000"
: "https://api.sassyspy.com",
websiteDomain:
process.env.NODE_ENV === "dev"
? "http://localhost:5173"
: "https://sassyspy-front.vercel.app/",
apiBasePath: "/auth",
websiteBasePath: "/auth",
},
recipeList: [
Passwordless.init({
flowType: "USER_INPUT_CODE",
contactMethod: "EMAIL",
}),
Dashboard.init(),
Session.init({
exposeAccessTokenToFrontendInCookieBasedAuth: true,
}),
UserRoles.init(),
],
});
const app = express();
// Connect to the database
connectDB();
// Middleware
app.use(
cors({
origin:
process.env.NODE_ENV === "dev"
? "http://localhost:5173"
: "https://sassyspy-front.vercel.app/",
allowedHeaders: ["content-type", ...supertokens.getAllCORSHeaders()],
credentials: true,
})
);
app.use(middleware());
here it is