"Bad Request: TokenError" during Google OAuth login with nginx ingress #8548
-
What happened?Issue DescriptionExperiencing a "Bad Request: TokenError" during Google OAuth login with LibreChat running behind an NGINX ingress controller in Kubernetes. The OAuth flow initiates correctly and redirects to Google, but fails during the callback phase with a token error. Error DetailsError Message:
Environment ConfigurationKubernetes Setup
LibreChat Configurationvalues.yaml: env:
PROXY: "true"
TRUST_PROXY: "true"
GOOGLE_CLIENT_ID: "your-client-id"
GOOGLE_CLIENT_SECRET: "your-client-secret"
GOOGLE_CALLBACK_URL: "https://chat.domain.com/oauth/google/callback"
ingress:
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: |
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host; Google OAuth Configuration
Troubleshooting Steps Taken1. Verified OAuth Configuration
2. Environment Variables
3. NGINX Configuration VerificationThe NGINX configuration shows correct proxy headers: proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $http_host; Additional Context
Version Informationv0.7.8 Steps to ReproduceAs mentioned in https://www.librechat.ai/docs/configuration/authentication/OAuth2-OIDC/google What browsers are you seeing the problem on?No response Relevant log outputTokenError: Bad Request
at OAuth2Strategy.parseErrorResponse (/app/node_modules/passport-oauth2/lib/strategy.js:373:12)
at OAuth2Strategy._createOAuthError (/app/node_modules/passport-oauth2/lib/strategy.js:420:16)
at /app/node_modules/passport-oauth2/lib/strategy.js:177:45
at /app/node_modules/oauth/lib/oauth2.js:196:18
at passBackControl (/app/node_modules/oauth/lib/oauth2.js:132:9)
at IncomingMessage.<anonymous> (/app/node_modules/oauth/lib/oauth2.js:157:7)
at IncomingMessage.emit (node:events:536:35)
at endReadableNT (node:internal/streams/readable:1698:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) ScreenshotsNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Google OAuth login is working perfectly on my end, it must be a configuration issue on your end. Please make sure you are following this correctly: https://www.librechat.ai/docs/configuration/authentication/OAuth2-OIDC/google |
Beta Was this translation helpful? Give feedback.
Fixed the issue , was missing allow social registration env variable