Skip to content

Custom Base Path not working #9274

Answered by NikitaKlimuk
NikitaKlimuk asked this question in Help
Discussion options

You must be logged in to vote

I will share my solution to this problem, one way or another you have to use app routing to create a custom path route for nextauth. The path will look like this src/app/next/api/auth/[...nextauth]/route.ts

Then create a route for NextAuth (app routing) - https://next-auth.js.org/configuration/initialization#route-handlers-app.

`
declare module 'next-auth' {
interface Session extends DefaultSession {
token: string;
user: DefaultSession['user'] & {
email: string;
name: string;
picture: string;
};
}
}

const auth = async (req: any, ctx: any) => {

const authOptions: AuthOptions = {
providers: [
GoogleProvider({...
credentialProviderLogin,
credentialProviderSignup,
],
secret:
session: {
},
pag…

Replies: 5 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ronijaat
Comment options

Answer selected by NikitaKlimuk
Comment options

You must be logged in to vote
1 reply
@ronijaat
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants