Comments (18)
Ugh I just figured it out.. My AUTH_GITHUB_SECRET
had a space in front of it. Everything is working for me now!
from ai-chatbot.
Hmm. Maybe take a look at #80
After the applied changes there, not only login works when deployed: https://ai-chatbot.vercel.sh/ but it also supports OAuth login on preview deployments, eg: https://ai-chatbot-1qzzt58mx.vercel.sh/
So this is definitely a configuration issue, or an outdated version of next-auth
that you are using.
from ai-chatbot.
I found #28 and changed the callback url to https://nextjs-chat-DOMAIN.vercel.app/api/auth/callback/github
but still get the issue.
from ai-chatbot.
could you add a reproduction? the deployed example mentioned here #28 (comment) works.
from ai-chatbot.
could you add a reproduction? the deployed example mentioned here #28 (comment) works.
sure, I made it public but what I described as step 2 is the only thing that I actually changed in the code base: https://github.com/cachho/nextjs-chat
Edit: screenshot from github oauth:
from ai-chatbot.
Had the same issue and resolved following the suggestion from @balazsorban44, however my lock file references 0.0.0-manual.223c6467 and the Vercel server logs were failing to deploy. I checked the logs and one of the messages suggested running pnpm install --no-frozen-lockfile
. I did that locally and then pushed to main and the build was successful. The Github login worked too. Ah, posted too soon. It's not exactly working because after authorizing the app I get redirected back but the login link does not change to my profile. I'll investigate tomorrow or over the weekend.
Before doing that, I also added the NEXTAUTH_SECRET generated from https://generate-secret.vercel.app/32
from ai-chatbot.
@cacho can you run pnpm up @auth/nextjs
in your project? Your lockfile suggests you forgot to follow #28 (comment)
You can see the available versions at https://www.npmjs.com/package/@auth/nextjs?activeTab=versions As of writing, the latest experimental
version is 0.0.0-manual.179c08d4 but you are on an 11 days old version.
@cresencio will need a reproduction.
from ai-chatbot.
@cacho can you run
pnpm up @auth/nextjs
in your project? Your lockfile suggests you forgot to follow #28 (comment)
Still the same stuff I've seen before. After a while the github authorize page opens, I authorize and then I get back to the sign in page (https://nextjs-chat-7wnb.vercel.app/api/auth/signin). Hitting the button again just reloads the page, and after hitting it for a dozen times I either get github's "reauthorization required" or "try signing in with a different account".
My repo has been updated.
edit: I found this in the logs
�[31m[auth][error][OAuthCallbackError]�[0m: OAuth Provider returned an error. Read more at https://errors.authjs.dev#oauthcallbackerror
at handleOAuth (/var/task/.next/server/chunks/541.js:9423:15)
at async callback_callback (/var/task/.next/server/chunks/541.js:9588:41)
at async AuthInternal (/var/task/.next/server/chunks/541.js:10413:38)
at async Auth (/var/task/.next/server/chunks/541.js:10664:30)
at async /var/task/.next/server/chunks/550.js:1087:37
from ai-chatbot.
@balazsorban44 - the issue seems to have gone away! All I did was clear my cache 🤷♂️ But thanks anyway!
from ai-chatbot.
FYI: I've added some improvements in this PR #80 which is waiting for approval/merge.
from ai-chatbot.
@cachho I noticed that your description's 5th step says:
Add https://nextjs-chat-DOMAIN.vercel.app/ as my Homepage URL and Authorization callback URL for the Github oauth app.
This is wrong. The callback URL needs to be: https://nextjs-chat-DOMAIN.vercel.app/api/auth/callback/github as documented at https://authjs.dev/reference/core/providers_github#callback-url
That might be the issue!
from ai-chatbot.
@cachho I noticed that your description's 5th step says:
Add https://nextjs-chat-DOMAIN.vercel.app/ as my Homepage URL and Authorization callback URL for the Github oauth app.
This is wrong. The callback URL needs to be: https://nextjs-chat-DOMAIN.vercel.app/api/auth/callback/github as documented at https://authjs.dev/reference/core/providers_github#callback-url
That might be the issue!
sorry, I did not describe that right (I will correct my original post). I already made that change, please take a look at the screenshot I posted: #78 (comment)
And thanks for the help!
from ai-chatbot.
I'm also having no luck and I've deployed the latest version of this repo.
My error is
�[31m[auth][error][CallbackRouteError]�[0m: Read more at https://errors.authjs.dev#callbackrouteerror
�[31m[auth][cause]�[0m: OperationProcessingError: "response" body "access_token" property must be a non-empty string
at processGenericAccessTokenResponse (/var/task/.next/server/chunks/57.js:8396:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async processAuthorizationCodeOAuth2Response (/var/task/.next/server/chunks/57.js:8556:20)
at async handleOAuth (/var/task/.next/server/chunks/57.js:9388:18)
at async callback_callback (/var/task/.next/server/chunks/57.js:9522:41)
at async AuthInternal (/var/task/.next/server/chunks/57.js:10347:38)
at async Auth (/var/task/.next/server/chunks/57.js:10598:30)
at async /var/task/.next/server/chunks/550.js:1087:37
�[31m[auth][details]�[0m: {
"provider": "github"
}
package.json
and pnpm-lock.yaml
both have version 0.0.0-manual.83c4ebd1
for next-auth
My Github OAuth app looks like:
(full expanded callback URL below)
from ai-chatbot.
@MacWatrous can you add a full reproduction, so I can take a look? As shown above, we have a deployed version now, working as expected, so there's likely something missing/misconfigured, I believe.
from ai-chatbot.
It solved the issue adding the vercel domain URL of the deployment as NEXTAUTH_URL on environment variables. It says NEXTAUTH_URL is required only for development purposes, but I guess something is missing on the code with that variable.
from ai-chatbot.
i think the issues are quite confusing. since a lot of them reference NEXTAUTH_URL, but now there is nothing in the template that is NEXTAUTH_URL
from ai-chatbot.
NEXTAUTH_URL
does not need to be set on Vercel and hasn't been required for a while. See https://next-auth.js.org/deployment#vercel
NEXTAUTH_URL is required only for development purposes
@sametcodes This does not sound correct, it's not needed locally either. Can you point me to where this is stated so we can update this?
Recently merged some more instructions (#85), please see https://github.com/vercel-labs/ai-chatbot/blob/9c25c3f4b25278962e2a48e6e0c31e2b40ea86d7/.env.example#L5-L13 and read #89 (comment) for more details, and a working example deployed on Vercel (even supporting preview deployments).
from ai-chatbot.
Had this same issue, realized the wrong key was copied to the variable. So I had to update them and redeploy the website for changes to take effect.
from ai-chatbot.
Related Issues (20)
- Questions about OnResponse HOT 1
- Adding azure-ad login method stops the sidebar from working/toggling HOT 3
- [Feature Request] How about a Vue (NuxtJS) version?
- useAtBottom hooks not working HOT 3
- How would I change the AI provider from OpenAI GPT-3 to Google Deepmind's Gemini Pro Model? HOT 1
- `ReferenceError: __dirname is not defined` when using sub-directory for root HOT 1
- Connection error. Compiled /_error in 393ms (3438 modules) ⨯ node_modules/.pnpm/[email protected]/node_modules/openai/core.mjs (272:18) @ OpenAI.makeRequest HOT 3
- Disable NextAuth.js for authentication
- how to disable authentication HOT 6
- Feature Request: Model Selection Menu, DALLE-3 and Upload Button for GPT Versions
- chat history refresh regression HOT 2
- Problems with initial deployment HOT 3
- Boilerplate runs on vercel deployment but not locally, missing VERCEL_URL HOT 2
- Feature: Edit functionality for Title
- 405 on Chat attempt initial setup HOT 3
- How can we Integrate Google Analytics without _app.tsx or _document.tsx in this Next.js Project ?
- "New Chat" Button is not working HOT 1
- Generate title automatically HOT 5
- Can't get any next-auth email provider (magic link) to work HOT 2
- Feature Request: Add Vote field in Message class to facilitate upvote/downvote for individual response. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ai-chatbot.