Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The user is not being redirected to the correct page after successful registration, instead, a login window continues to appear. Is there a setting that is incorrect? I have already obtained the latest code. #955

Closed
huicewang opened this issue Jan 16, 2024 · 14 comments

Comments

@huicewang
Copy link

The user is not being redirected to the correct page after successful registration, instead, a login window continues to appear. Is there a setting that is incorrect? I have already obtained the latest code.
image

@huicewang
Copy link
Author

After successful registration, the page also redirects to the login page.

@finitespace
Copy link

I am also having issues with this and cannot login

@Hewlbern
Copy link

Hewlbern commented Feb 7, 2024

Same issue as well

@regmibijay
Copy link
Contributor

If you created the docker instances using docker compose up you need to delete volumes and force recreate after you change settings. Set WEB_DOMAIN to your chat interface in .env like WEB_DOMAIN=https://chat.mydomain.com and then recreate whole stack.

@marvasgit
Copy link

I have same problem, even if you disable email verification or try to use -google_oauth i have same error
those are the logs from Be. i think they might be useful to fix
INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit) INFO: 172.18.0.7:41684 - "GET /health HTTP/1.1" 200 OK INFO: 172.18.0.7:60080 - "GET /health HTTP/1.1" 200 OK INFO: 172.18.0.6:39336 - "GET /auth/type HTTP/1.1" 200 OK INFO: 172.18.0.6:39352 - "GET /manage/me HTTP/1.1" 403 Forbidden INFO: 172.18.0.7:60186 - "GET /health HTTP/1.1" 200 OK INFO: 172.18.0.6:39336 - "GET /manage/me HTTP/1.1" 403 Forbidden INFO: 172.18.0.6:39336 - "GET /auth/type HTTP/1.1" 200 OK (trapped) error reading bcrypt version Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin version = _bcrypt.__about__.__version__ ^^^^^^^^^^^^^^^^^ AttributeError: module 'bcrypt' has no attribute '__about__' 02/26/2024 01:27:49 PM users.py 186 : User 262940f4-916d-4d33-a68c-306a54522ff4 has registered. INFO: 172.18.0.7:60196 - "POST /auth/register HTTP/1.1" 201 Created INFO: 172.18.0.7:60208 - "POST /auth/login HTTP/1.1" 204 No Content INFO: 172.18.0.6:41688 - "GET /auth/type HTTP/1.1" 200 OK INFO: 172.18.0.6:41704 - "GET /manage/me HTTP/1.1" 403 Forbidden INFO: 172.18.0.6:41708 - "GET /manage/indexing-status HTTP/1.1" 403 Forbidden INFO: 172.18.0.6:41746 - "GET /secondary-index/get-embedding-models HTTP/1.1" 403 Forbidden INFO: 172.18.0.6:41754 - "GET /query/valid-tags HTTP/1.1" 403 Forbidden INFO: 172.18.0.6:41718 - "GET /persona HTTP/1.1" 403 Forbidden INFO: 172.18.0.6:41732 - "GET /manage/document-set HTTP/1.1" 403 Forbidden INFO: 172.18.0.7:46894 - "GET /health HTTP/1.1" 200 OK INFO: 172.18.0.7:46902 - "POST /auth/login HTTP/1.1" 204 No Content INFO: 172.18.0.7:46918 - "GET /health HTTP/1.1" 200 OK

@regmibijay
Copy link
Contributor

You are probably using IP in your local network. Setting cookie only works with localhost or https:// domains as cookie was set as https only. You can try ssh tunning a local port (like 9000) to 8080 to your servers port and then accessing via http://localhost:9000

@marvasgit
Copy link

You are probably using IP in your local network. Setting cookie only works with localhost or https:// domains as cookie was set as https only. You can try ssh tunning a local port (like 9000) to 8080 to your servers port and then accessing via http://localhost:9000

It's not deployed on localhost but the logs are from inside the docker container from docker compose, but the fact that cookie is working on https only should be put in official documentation.
Later will upload few more screenshot with more information during registration and login process.

@marvasgit
Copy link

marvasgit commented Feb 26, 2024

2024-02-26_16-15
1,2 is successful registration.
3,4 login attempt.
5 is registration attempt with same username.
maybe its worth mentioning that's not https but http.
I will try https setup tomorrow just to see if the issue is with the cookie

@regmibijay
Copy link
Contributor

As you can see, 4 is returning 204 as no cookie was passed. Can you try with ssh -L 8080:8080 <your_remote_ip> and then use http://localhost:8080 in your browser to access danswer?

@regmibijay
Copy link
Contributor

regmibijay commented Feb 26, 2024

I think problem here might be this line which uses default CookieTransport cookie_secure=True by default and localhost is treated differently in browser as other IPs.

@regmibijay
Copy link
Contributor

possible fix would be something along the lines

# WEB_DOMAIN already imported 

cookie_transport = CookieTransport(
  cookie_max_age=SESSION_EXPIRE_TIME_SECONDS,
  cookie_secure=WEB_DOMAIN.startswith("https://")
)

thoughts?

regmibijay added a commit to regmibijay/danswer that referenced this issue Feb 26, 2024
@regmibijay regmibijay mentioned this issue Feb 26, 2024
@marvasgit
Copy link

possible fix would be something along the lines

# WEB_DOMAIN already imported 



cookie_transport = CookieTransport(

  cookie_max_age=SESSION_EXPIRE_TIME_SECONDS,

  cookie_secure=WEB_DOMAIN.startswith("https://")

)

thoughts?

This should be extracted as configuration, because if it's purely internal use why should i be forced to use https ?

@regmibijay
Copy link
Contributor

That is the point, we only use secure cookies if you configured WEB_DOMAIN to start with https otherwise not. That will give you freedom of using any protocol as you want.

@marvasgit
Copy link

That is the point, we only use secure cookies if you configured WEB_DOMAIN to start with https otherwise not. That will give you freedom of using any protocol as you want.
sry my bad. didnt follow it on the phone.
its good solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants