attempted upgrade
This commit is contained in:
@@ -6,23 +6,24 @@ import UserRoles from "supertokens-node/recipe/userroles";
|
||||
import { appInfo } from "./config";
|
||||
import PasswordlessDevelopmentMode from "./recipes/passwordless-development-mode";
|
||||
import { logger } from "./";
|
||||
import passwordlessTwilioVerify from "./recipes/passwordless-twilio-verify";
|
||||
|
||||
export const backendConfig = (): TypeInput => {
|
||||
return {
|
||||
framework: "custom",
|
||||
supertokens: {
|
||||
connectionURI:
|
||||
process.env.SUPERTOKENS_URI || "https://try.supertokens.io",
|
||||
import.meta.env.SUPERTOKENS_URI || "https://try.supertokens.io",
|
||||
},
|
||||
appInfo,
|
||||
recipeList: [
|
||||
PasswordlessDevelopmentMode.init(),
|
||||
Session.init({
|
||||
cookieSameSite: "lax",
|
||||
cookieSecure: process.env.NODE_ENV === "production",
|
||||
cookieSecure: import.meta.env.NODE_ENV === "production",
|
||||
cookieDomain:
|
||||
process.env.NODE_ENV === "production" ? ".example.com" : undefined,
|
||||
antiCsrf: process.env.NODE_ENV === "production" ? "VIA_TOKEN" : "NONE",
|
||||
import.meta.env.NODE_ENV === "production" ? ".example.com" : undefined,
|
||||
antiCsrf: import.meta.env.NODE_ENV === "production" ? "VIA_TOKEN" : "NONE",
|
||||
|
||||
// Debug only
|
||||
exposeAccessTokenToFrontendInCookieBasedAuth: true,
|
||||
@@ -30,13 +31,13 @@ export const backendConfig = (): TypeInput => {
|
||||
Dashboard.init(),
|
||||
UserRoles.init(),
|
||||
],
|
||||
telemetry: process.env.NODE_ENV !== "production",
|
||||
telemetry: import.meta.env.NODE_ENV !== "production",
|
||||
};
|
||||
};
|
||||
|
||||
let initialized = false;
|
||||
export function ensureSuperTokensBackend() {
|
||||
if (!initialized) {
|
||||
if (!initialized && typeof window === 'undefined') {
|
||||
SuperTokens.init(backendConfig());
|
||||
initialized = true;
|
||||
logger.simple("Backend initialized");
|
||||
|
||||
Reference in New Issue
Block a user