Skip to content

Redirect to login when PWA/Web-App is opened and cookie is expired #2884

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

Closed
ntimo opened this issue Jul 11, 2022 · 5 comments · Fixed by #2903
Closed

Redirect to login when PWA/Web-App is opened and cookie is expired #2884

ntimo opened this issue Jul 11, 2022 · 5 comments · Fixed by #2903
Assignees

Comments

@ntimo
Copy link
Contributor

ntimo commented Jul 11, 2022

Current Situation

Currently when a user opens a PWA e.g. code-server a message appears {"message":"Cookie \"session_token\" or query parameter must be provided."} stating that the cookie is expired. The user then has to open a new chrome window open the coder url login and refresh the pwa. This is not ideal of a workflow.

Desired Solution

The PWA page should just redirect to the login so that the user can authenticate and then load the application e.g. code-server.

How to reproduce

  1. Login to Code
  2. Start a workspace with code-server
  3. Install code-server as chrome pwa
  4. Wait for auth cookie to expire or delete it
  5. Open the PWA
@ntimo ntimo changed the title Redirect to login when PWA is opened and cookie is expired Redirect to login when PWA/Code App is opened and cookie is expired Jul 11, 2022
@ntimo ntimo changed the title Redirect to login when PWA/Code App is opened and cookie is expired Redirect to login when PWA/Web-App is opened and cookie is expired Jul 11, 2022
@kylecarbs
Copy link
Member

Ahh, good issue! We'll have to adjust our middleware handling to do an auth redirection instead.

@kylecarbs kylecarbs self-assigned this Jul 11, 2022
@ketang
Copy link
Contributor

ketang commented Jul 11, 2022

@AbhineetJain might be related to PWA work you're looking at

@ntimo
Copy link
Contributor Author

ntimo commented Jul 11, 2022

Thanks @kylecarbs for adding this so fast your are awesome.

@ntimo
Copy link
Contributor Author

ntimo commented Jul 11, 2022

@kylecarbs I think there might be a bug. So my setup is the following. The workspace is running and I am logged out. I then open the PWA and get redirect to the login page, when I then login get a "code-server is offline!" page, and this is not the case. When I press Strg+R to reload the page code-server loads correctly.

Edit: I created a new issue for this.

@kylecarbs
Copy link
Member

kylecarbs commented Jul 11, 2022 via email

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

Successfully merging a pull request may close this issue.

3 participants