We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello!
I am using Credentials to login on my website. I build my website on localhost and everything worked fine. When i moved to my server, after login, it redirect me to http://localhost:3000/api/auth/callback/credentials instead of http://example.com/api/auth/callback/credentials.
Thanks!
import NextAuth from 'next-auth' import Providers from 'next-auth/providers' const baseUrl = process.env.BASE_URL export default NextAuth({ NEXTAUTH_URL: process.env.BASE_URL, providers: [ Providers.Credentials({ name: 'your account', credentials: { email: { label: "Email", type: "text", placeholder: "" }, password: { label: "Password", type: "password" } }, callbacks: { redirect: async (url, baseUrl) => { return Promise.resolve(url) } }, async authorize(credentials, req) { const res = await fetch(`${process.env.BASE_URL}/api/user/login`, { method: 'POST', body: JSON.stringify(credentials), headers: { "Content-Type": "application/json" } }) const user = await res.json() if (res.ok && user.response) { return user.response } return null } }) ], session: { jwt: true, maxAge: 30 * 24 * 60 * 60 } })
Yes, I am willing to help answer this question in a PR
The text was updated successfully, but these errors were encountered:
I figured it out. I had to add NEXTAUTH_URL to .env file
Sorry, something went wrong.
No branches or pull requests
Question 💬
Hello!
I am using Credentials to login on my website. I build my website on localhost and everything worked fine. When i moved to my server, after login, it redirect me to http://localhost:3000/api/auth/callback/credentials instead of http://example.com/api/auth/callback/credentials.
Thanks!
How to reproduce ☕️
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
The text was updated successfully, but these errors were encountered: