https://supertokens.com/ logo
#support-questions
Title
# support-questions
m

michaelzhuk

04/30/2021, 12:56 PM
Copy code
export let frontendConfig = () => {
  return {
    useReactRouterDom: false,
    appInfo,
    recipeList: [
      ThirdPartyEmailPasswordReact.init({
        signInAndUpFeature: {
          providers: [],
        },
        async getRedirectionURL(context) {
          console.log("> CONTEXT", context)
          if (context.action === "SUCCESS") {
            return "/brand"
          }
        },
        onHandleEvent(context) {
          switch (context.action) {
            case "SUCCESS":
              window.opener?.location.reload()
              window.close()
          }
        },
      }),
      SessionReact.init(),
    ],
  }
}

export let backendConfig = () => {
  return {
    supertokens: {
      connectionURI: process.env.SUPERTOKENS_DOMAIN,
      apiKey: process.env.SUPERTOKENS_API_KEY,
    },
    appInfo,
    recipeList: [
      ThirdPartyEmailPasswordNode.init({
        signUpFeature: {
          handlePostSignUp: async (user) => {
            const { id, email } = user
            try {
              await fetchApi("/api/users/create", { id, email })
            } catch (error) {
              console.log("> Failed to sign up", error)
            }
          },
        },
      }),
      SessionNode.init(),
    ],
    isInServerlessEnv: true,
  }
}