AgentGPT icon indicating copy to clipboard operation
AgentGPT copied to clipboard

Sign in not working!

Open MulletDad1 opened this issue 2 years ago • 10 comments

So i got Agentgpt up and running in docker container but it wants me to sign in with google or github but when i click on it, i just get an error and refused to connect. does anyone know how to fix this?

MulletDad1 avatar May 08 '23 18:05 MulletDad1

just happened to me image

Tembeyo avatar May 08 '23 21:05 Tembeyo

the same with you,but it's ok to sign in in https://agentgpt.reworkd.ai/,not local.

xiguadaddy avatar May 09 '23 02:05 xiguadaddy

I am facing the same problem.

parthpandya1729 avatar May 09 '23 18:05 parthpandya1729

me too

dst1213 avatar May 09 '23 23:05 dst1213

Unable to login using Google or other logins, using the latest release v0.3.0-beta deployed on a hosted server.

After clicking one of the login providers: Google, GitHub or Discord, it tries to redirect to the login to: http://localhost:3000/api/auth/signin/google.

I have changed the .env and .env.docker NEXTAUTH_URL=http://localhost:3000 to our domain, and then tried IP address, but it still tries to redirect to http://localhost:3000/api/auth/signin/google, http://localhost:3000/api/auth/signin/github, and http://localhost:3000/api/auth/signin/discord.

Where does this need to be changed in order to get it to resolve correctly to the server IP and/or domain?

BDAthans avatar May 10 '23 18:05 BDAthans

Hey thanks for the report @BDAthans

For some clarity, local installations running in development mode will use an insecure local authentication mechanism to avoid requiring configuration for these auth providers.

For the production issue you've mentioned, me and @awtkns will have to take a deeper look

asim-shrestha avatar May 10 '23 22:05 asim-shrestha

Hi @BDAthans would you be able to provide your Google Oauth client configuration? The callback url in the cloud console should be http://localhost:3000/api/auth/signin/google

awtkns avatar May 12 '23 13:05 awtkns

Hi @BDAthans would you be able to provide your Google Oauth client configuration? The callback url in the cloud console should be http://localhost:3000/api/auth/signin/google

Hi @awtkns, I'm sorry but I am not comfortable providing our specific Google Oauth information as it can potentially pose security risks if not handled properly, especially with this being a public domain.

Can you explain why what exactly you are looking for and why? When using the AgentGPT hosted on your own site, we don't have this issue or need our specific Oauth to make it work.

BDAthans avatar May 12 '23 18:05 BDAthans

Also noticed another issue regarding the authentication. When the application launches on the server it will bind to port 3001 if port 3000 is already bound at the time of launch, but when you go to 'Sign In' and authenticate, it redirects back to port 3000 instead of continuing to use port 3001.

BDAthans avatar May 12 '23 18:05 BDAthans

Hi @awtkns, I'm sorry but I am not comfortable providing our specific Google Oauth information as it can potentially pose security risks if not handled properly, especially with this being a public domain.

Can you explain why what exactly you are looking for and why? When using the AgentGPT hosted on your own site, we don't have this issue or need our specific Oauth to make it work.

@BDAthans you're google cloud console configuration should look like the below assuming you are running it on port 3000. Nothing sensitive in there, just never share your secret key.

Screenshot 2023-05-12 at 9 27 41 PM

Also noticed another issue regarding the authentication. When the application launches on the server it will bind to port 3001 if port 3000 is already bound at the time of launch, but when you go to 'Sign In' and authenticate, it redirects back to port 3000 instead of continuing to use port 3001.

This is expected behaviour. Typically with Oauth integrations wildcard's are not allowed and they require a hardcoded redirect url.

awtkns avatar May 12 '23 18:05 awtkns

I solved this by changing the editing a column in the table. The error was that the access token was too long. Fix: add @db.Text as shown below. Make sure you push the update to Planetscale :)

model Account { id String @id @default(cuid()) userId String type String provider String providerAccountId String refresh_token String? access_token String? @db.Text expires_at Int? token_type String? scope String? id_token String? session_state String? user User @relation(fields: [userId], references: [id], onDelete: Cascade)

jaredlutz avatar May 18 '23 17:05 jaredlutz

Glad you were able to fix it @jaredlutz :) Care to upload a PR with the fix?

asim-shrestha avatar May 18 '23 21:05 asim-shrestha

Closing as the solution was found !!! If you are still facing these issues feel free to message in the issue linked here: https://github.com/reworkd/AgentGPT/issues/886

jasangill1 avatar Jul 05 '23 04:07 jasangill1