lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
44.56k stars 9.99k forks source link

[Bug] docker+nextauth使用github身份验证出现问题 #4703

Closed ilovelxy closed 2 hours ago

ilovelxy commented 2 hours ago

📦 Environment

Docker

📌 Version

1.31.8

💻 Operating System

Ubuntu

🌐 Browser

Chrome

🐛 Bug Description

使用docker+nextauth部署完成后,正常进入网站点击登陆,然后输入用户名和密码,登陆后会进入一个404页面,地址栏显示https://github.com/login/oauth/authorize?client_id=undefined&code_challenge=oPEiL2Nx3hBn......

image

.env文件中的设置是: image

github app中配置好了回调地址是:http://localhost:3210/api/auth/callback/github

为什么会这样,是哪里设置的不对吗

📷 Recurrence Steps

No response

🚦 Expected Behavior

No response

📝 Additional Information

No response

lobehubbot commented 2 hours ago

👀 @ilovelxy

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

dosubot[bot] commented 2 hours ago

Hey there, @ilovelxy! 👋 I'm here to help you with any bugs, questions, or contributions while you wait for a human maintainer. Let's squash this bug together!

I found a similar issue that might be related to the problem you're experiencing. The issue titled "[Bug] docker部署时next-auth不可用" was closed and suggested configuring the NEXTAUTH_URL variable according to the documentation [1].

For your specific issue with the client_id=undefined error, ensure that your .env file is correctly configured with the necessary environment variables. Here are the steps you should follow:

  1. Check Environment Variables:

    • Ensure that AUTH_GITHUB_ID and AUTH_GITHUB_SECRET are correctly set in your .env file. These should be the Client ID and Client Secret from your GitHub OAuth application.
    • Verify that NEXTAUTH_URL is set to the correct callback URL, which should match the one configured in your GitHub app (http://localhost:3210/api/auth/callback/github).
  2. GitHub OAuth Application Configuration:

    • Double-check that the callback URL in your GitHub OAuth application settings matches the NEXTAUTH_URL in your .env file.
  3. Generate a Secret:

    • Make sure NEXT_AUTH_SECRET is set. You can generate a secret using a command like openssl rand -base64 32.

These steps should help resolve the client_id=undefined error and the 404 page issue after logging in. If the problem persists, ensure that all environment variables are correctly loaded in your Docker setup.

To continue talking to Dosu, mention @dosu.

ilovelxy commented 2 hours ago

这几个步骤已经确认过了还是同样的现象

lobehubbot commented 2 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I have confirmed these steps and still have the same phenomenon.

lobehubbot commented 2 hours ago

✅ @ilovelxy

This issue is closed, If you have any questions, you can comment and reply.\ 此问题已经关闭。如果您有任何问题,可以留言并回复。