#Google oauth Configuration

1 messages · Page 1 of 1 (latest)

void junco
#

So i'm having trouble getting the Google login functionality working. I've setup apps in several other oauth apps. I've pasted in GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET, and left the callbackurl to the default, and configured in my app. Button is not showing up on the front page (ALLOW_SOCIAL_LOGIN is true), although JWT values are still "secret" ....

I've also rebuilt with docker-compose build and up.

did I miss a step? I've also setup a GITHUB app and pasted the appropriate client and secret values, but there are no buttons showing up anywhere.

simple ermine
#

there's an option ALLOW_SOCIAL_LOGIN= that you need to change to true in the .env

void junco
#

hrmm, had that set, there are a couple more params at the bottom of the file that seem to impact the oauth callback

#

###########################

Application Domains

###########################

Note:

Server = Backend

Client = Public (the client is the url you visit)

For the Google login to work in dev mode, you will need to change DOMAIN_SERVER to localhost:3090 or place it in .env.development

DOMAIN_CLIENT=http://localhost:3080
DOMAIN_SERVER=http://localhost:3090

simple ermine
#

you need to replace these with your custom doamin:

DOMAIN_CLIENT=http://localhost:3080/
DOMAIN_SERVER=http://localhost:3090/
#

I'm tunneling a connection to a custom domain with cloudflare on another pc, I'll go grab my .env real quick to see how I did it

#
HOST=0.0.0.0
PORT=3080

# Allow Public Registration
ALLOW_REGISTRATION=true

# Allow Social Registration
ALLOW_SOCIAL_LOGIN=true

# JWT Secrets
JWT_SECRET=5498fcf9f7.........

DOMAIN_CLIENT=https://custom_domain.com
DOMAIN_SERVER=https://custom_domain.com
#

I just copy pasted what I had to tweak to make it work

void junco
#

hrmm are you tunneling from port 80 to 3080?

simple ermine
#

I don't think so

#

I think that's why I had to change the host to 0.0.0.0

void junco
#

do your users have to go to http://custom_domain.com:3080?

simple ermine
#

no, just, custom_domain.com

#

can I see it in the cloudflare dashboard? I can check what I did

#

I don't remember what I did and I'm not very good with cloudflare 😅

frail ore
#

Here's a video I watched recently. There's a bit to know and then it gets really easy. https://www.youtube.com/watch?v=Q5dG8g4-Sx0&t=918s

Thanks to Linode for sponsoring this video!

Sign up today and get a $100 60-day credit on your new Linode account, link is in the description.

🔗 https://dbte.ch/linode

/=========================================/

Getting started with Cloudflare can be a bit overwhelming when you're first getting started with self-hosting.

This video will h...

▶ Play video
void junco
#

is that just a page rule fuegovic?

#

that video is great jerry 😉 tunnel directly to the docker container! 😄 just trying to get it working

simple ermine
#

I’m on my phone right now, I’ll be able to access my cloudflare dashboard in a few minutes, if there a specific page that would help?

void junco
#

it's okay fuegovic, I appreciate the help. I use cloudflare extensively, I've just never created a tunnel before 😉 this is pretty cool.

simple ermine
#

good, I got it working through trial and error and I don't remember what I did, my screenshot was from here btw

frail ore
simple ermine
void junco
#

hahaha it worked quite well actually.

I added the setup to the docker-compose.yaml actually. Once you create your tunnel, and it generates a token for you, you can add this to your docker-compose.yaml under services:

cloudflared-example: image: cloudflare/cloudflared:latest container_name: Cloudflared-token command: 'tunnel --no-autoupdate run --token <YOUR_SUPPLIED_TOKEN_HERE> user: root restart: always

then do a docker-compose build, and docker-compose up -d ... and it worked.

#

no port forwarding required (which makes configuring the google oauth provider much MUCH easier ;).

#

updated custom domains at the bottom of the file, and deleted all the unnecessary localhost domains in the oauth credentials.

it even defaults to cloudflares https 😉

I hope this helps someone else!

#

[solved]

simple ermine
void junco
#

yup.google works, although github is giving me an Internal Server Error. after requesting github authorization, it redirects to: /oauth/github/callback?code=e351e13daad293b4a729

simple ermine
void junco
#

ahh

bitter lodge
jolly cave
#

hi guys, same here

the problem is that redirect is not happening after the oauth callback from google

It's basically this line

https://github.com/danny-avila/LibreChat/blob/main/api/server/routes/oauth.js#L50

passport returns a 302 redirect https://www.passportjs.org/concepts/authentication/middleware/

but no redirect is actually happening at the browser level and so the page shows a 404

I've tried forcing the redirect from the oauthHandler function including setting the HTTP status on the response to 200 and changing the mime-type to html instead of text.

My suspicion is that there is a disconect between the frontend and backend at this point and the redirect is never getting to the browser.

Can someone help?

GitHub

Enhanced ChatGPT Clone: Features Agents, Anthropic, AWS, OpenAI, Assistants API, Azure, Groq, o1, GPT-4o, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code...