I followed the steps in this docs https://supertok...
# support-questions
f
I followed the steps in this docs https://supertokens.com/docs/emailpassword/nextjs/init but I'm getting an infinite redirect
r
What’s your frontend config like?
f
Copy code
export const appInfo = {
  // learn more about this on https://supertokens.com/docs/emailpassword/appinfo
  appName: "z8",
  apiDomain: "http://localhost:5000",
  websiteDomain: "http://localhost:3000",
  apiBasePath: "/auth",
  websiteBasePath: "/auth",
};
Copy code
import EmailPasswordReact from "supertokens-auth-react/recipe/emailpassword";
import SessionReact from "supertokens-auth-react/recipe/session";
import { appInfo } from "./appInfo";

export const frontendConfig = () => {
  return {
    appInfo,
    recipeList: [EmailPasswordReact.init(), SessionReact.init()],
  };
};
then in _app.tsx I have this
Copy code
import "../styles/globals.css";
import { QueryClient, QueryClientProvider } from "react-query";
import type { AppProps } from "next/app";
import SuperTokensReact from "supertokens-auth-react";
import EmailPassword from "supertokens-auth-react/recipe/emailpassword";

import { frontendConfig } from "../config/frontendConfig";
import dynamic from "next/dynamic";

if (typeof window !== "undefined") {
  // we only want to call this init function on the frontend, so we check typeof window !== 'undefined'
  SuperTokensReact.init(frontendConfig());
}

const EmailPasswordAuthNoSSR = dynamic(
  new Promise((res) => res(EmailPassword.EmailPasswordAuth)) as any,
  { ssr: false }
);

const queryClient = new QueryClient();

function MyApp({ Component, pageProps }: AppProps) {
  
  return (
    <EmailPasswordAuthNoSSR>
      <QueryClientProvider client={queryClient}>
        <Component {...pageProps} />
      </QueryClientProvider>
    </EmailPasswordAuthNoSSR>
  );
}

export default MyApp;
it was working a couple of weeks ago, I deleted the cookies and then saw this behavior
r
Can you enable debug logging and then show me the output?
f
how can I enable it?
r
There is a troubleshooting section in the docs
r
And is EmailPasswordAuthNoSSR being used for all routes? Even the /auth route?
f
yep, do you think that might be the issue?
r
Cause that would cause an infinite redirect
Yeaa
f
let me try adding it to individual routes
r
Yup
f
it works πŸ˜„
thank you very much!
it's weird because I swear it was working a couple of weeks ago
I really appreciate your help πŸ™‚
r
Hmm
πŸ‘
2 Views