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

question: Keeping users logged in longer? #24

Closed
poperigby opened this issue Jan 23, 2022 · 4 comments
Closed

question: Keeping users logged in longer? #24

poperigby opened this issue Jan 23, 2022 · 4 comments
Assignees
Labels
cookie question Further information is requested

Comments

@poperigby
Copy link

I'm a bit confused on how to keep users logged in for longer. I set my cookie lifetime to 1440, and it definitely wasn't lasting that long. I would just get booted from my services and have to login again every once in a while.

@poperigby poperigby added need triage question Further information is requested labels Jan 23, 2022
@greenpau
Copy link
Owner

@poperigby , please create a gist of your Caddyfile and share it here.

The “cookie lifetime” is the max lifetime of a cookie in a browser cache. It should be send to something like 8 hours.

The “crypto key lifetime” is the lifetime of the JWT token inside the cookie. That is set to 15 minutes by default.

You probably want to keep the “crypto key lifetime” as is, but set cookie lifetime to days. When the token expires, the cookie carrying it is still “alive” and serves as a clue for a redirection.

@poperigby
Copy link
Author

please create a gist of your Caddyfile and share it here

Here

You probably want to keep the “crypto key lifetime” as is, but set cookie lifetime to days. When the token expires, the cookie carrying it is still “alive” and serves as a clue for a redirection.

The thing is, even when I set it to 24 hours, it definitely wasn't lasting that long.

@greenpau
Copy link
Owner

@poperigby , set the following. That would keep session up for an hour, while keeping your cookie alive for 2 hours.

authentication portal myportal {
  crypto default token lifetime 3600
  cookie lifetime 7200

Want to keep it alive for a day?

authentication portal myportal {
  crypto default token lifetime 86400
  cookie lifetime 172800

@poperigby
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cookie question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants