NextJS + NestJS Query Auth0 api/auth/callback/auth0 Not Found

When i have the given template above and try to login i am instantly getting
{
"message": "Cannot GET /api/auth/callback/auth0?code=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&state=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"error": "Not Found",
"statusCode": 404
}
{
"message": "Cannot GET /api/auth/callback/auth0?code=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&state=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"error": "Not Found",
"statusCode": 404
}
waht am i missing
3 Replies
kapa.ai
kapa.ai2mo ago
Hi @Justin. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain specific information about handling Auth0 callbacks with NextJS and NestJS. However, I can guide you on how to set up Auth0 with Refine. You can create a new Auth0 account and set up a new web application. You will get domain, client ID, and secret ID information. You can then add these to your .env file in your project root. Here is an example of how to use these in your index.tsx file:
import React from "react";
import { createRoot } from "react-dom/client";
import { Auth0Provider } from "@auth0/auth0-react";
import App from "./App";

const container = document.getElementById("root") as HTMLElement;
const root = createRoot(container);

root.render(
<React.StrictMode>
<Auth0Provider
domain={process.env.REACT_APP_AUTH0_DOMAIN as string}
clientId={process.env.REACT_APP_AUTH0_CLIENT_ID as string}
redirectUri={window.location.origin}
>
<App />
</Auth0Provider>
</React.StrictMode>,
);
import React from "react";
import { createRoot } from "react-dom/client";
import { Auth0Provider } from "@auth0/auth0-react";
import App from "./App";

const container = document.getElementById("root") as HTMLElement;
const root = createRoot(container);

root.render(
<React.StrictMode>
<Auth0Provider
domain={process.env.REACT_APP_AUTH0_DOMAIN as string}
clientId={process.env.REACT_APP_AUTH0_CLIENT_ID as string}
redirectUri={window.location.origin}
>
<App />
</Auth0Provider>
</React.StrictMode>,
);
You can find more details about this in the Refine documentation (https://refine.dev/docs/advanced-tutorials/auth/auth0#login). For your specific issue with NextJS and NestJS, I would recommend checking their respective documentations or reaching out to their communities for more specific guidance. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@337253340121399296> kapa.ai is still learning and improving, please let us know how it did by reacting below
adverse-sapphire
adverse-sapphire2mo ago
So what really happend was since my backend was running on port 3000 i still got automatically redirected to :3000 instead of 3001