NextAuth v5, api/auth/providers
Unanswered
New Guinea Freshwater Crocodile posted this in #help-forum
New Guinea Freshwater CrocodileOP
How to change callbackUrl and signinUrl ?
In development mode my api/auth/providers looks like this:
{
"google": {
"id": "google",
"name": "Google",
"type": "oidc",
"signinUrl": "http://localhost:3000/api/auth/signin/google",
"callbackUrl": "http://localhost:3000/api/auth/callback/google"
},
"credentials": {
"id": "credentials",
"name": "Credentials",
"type": "credentials",
"signinUrl": "http://localhost:3000/api/auth/signin/credentials",
"callbackUrl": "http://localhost:3000/api/auth/callback/credentials"
}
}
And in production, when I upload to vercel it turns into:
{
"google": {
"id": "google",
"name": "Google",
"type": "oidc",
"signinUrl": "https://web-store-dc-flame.vercel.app/api/auth/signin/google",
"callbackUrl": "https://web-store-dc-flame.vercel.app/api/auth/callback/google"
},
"credentials": {
"id": "credentials",
"name": "Credentials",
"type": "credentials",
"signinUrl": "https://web-store-dc-flame.vercel.app/api/auth/signin/credentials",
"callbackUrl": "https://web-store-dc-flame.vercel.app/api/auth/callback/credentials"
}
}
Pay attention to "signinUrl" and "callbackUrl", my task is that I post my site to another hosting, but I can’t find a way to change signinUrl and callbackUrl inside my code
In development mode my api/auth/providers looks like this:
{
"google": {
"id": "google",
"name": "Google",
"type": "oidc",
"signinUrl": "http://localhost:3000/api/auth/signin/google",
"callbackUrl": "http://localhost:3000/api/auth/callback/google"
},
"credentials": {
"id": "credentials",
"name": "Credentials",
"type": "credentials",
"signinUrl": "http://localhost:3000/api/auth/signin/credentials",
"callbackUrl": "http://localhost:3000/api/auth/callback/credentials"
}
}
And in production, when I upload to vercel it turns into:
{
"google": {
"id": "google",
"name": "Google",
"type": "oidc",
"signinUrl": "https://web-store-dc-flame.vercel.app/api/auth/signin/google",
"callbackUrl": "https://web-store-dc-flame.vercel.app/api/auth/callback/google"
},
"credentials": {
"id": "credentials",
"name": "Credentials",
"type": "credentials",
"signinUrl": "https://web-store-dc-flame.vercel.app/api/auth/signin/credentials",
"callbackUrl": "https://web-store-dc-flame.vercel.app/api/auth/callback/credentials"
}
}
Pay attention to "signinUrl" and "callbackUrl", my task is that I post my site to another hosting, but I can’t find a way to change signinUrl and callbackUrl inside my code
3 Replies
New Guinea Freshwater CrocodileOP
hello?
@New Guinea Freshwater Crocodile hello?
Northeast Congo Lion
You should be able to set
baseUrl in auth.ts or AUTH_URL in your env to whatever you need it to be. I thought it was supposed to automatically detect some stuff from Vercel, so please report back if something works. I'm getting ready to deploy an app through vercel.@Northeast Congo Lion You should be able to set `baseUrl` in `auth.ts` or `AUTH_URL` in your env to whatever you need it to be. I thought it was supposed to automatically detect some stuff from Vercel, so please report back if something works. I'm getting ready to deploy an app through vercel.
New Guinea Freshwater CrocodileOP
Yes, you're right, it works fine on Verсel, and the url is set automatically. But I’m trying to do this on another hosting and this is the problem, thank you very much for the answer, because it brought me to one thought that a bunch of articles and threads on the Internet that I read could not lead me to. When I can solve the problem, I will tell you my solution