mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-11 07:42:58 +03:00
Feature: Token Session Duration customization #104
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BizkitCake on GitHub.
Reproduction steps
Disclaimer: I'm not devops nor programmer, former QA. Selfhosting is my hobby.
Put 1440 value was put in Session Duration in UI in 'Application Configuration'.

Application Configuration - Session Duration example (it's grayed out because of UI_CONFIG_DISABLED=true value, that's expected)
Everything is set up in Docker compose. Pocket ID is pretty basic. Here's some env vars for it
I've also tried to put there two more params to hardcode the config:
OIDC client config is pretty basic: callbacks and callbacks-logout urls (*.domain.com & domain.com) as well as PKCE enabled
Middleware OIDC described like this:
However when I check OIDC Data Preview in Pocket ID webui I see that exp-iat time is just 1h both for ID Token and Access Token.

Access Token example:
Overall, it works just fine. It covers my apps with OIDC auth flow. However when I work with n8n or grafana - I usually do that for more than 1h. And at the moment of re-auth my apps stops responding or dropping some artifacts, so I have to open id.domain.com on in another tab to preserve the progress in my actions.
Expected behavior
SESSION_DURATION should change according to the setting
Actual Behavior
Consistent 1h session regardless of configs
Version and Environment
Stack:
Everything is in docker
OS: Debian 12 (LXC Container) / x86_64
Log Output
2025-07-27T17:55:20+03:00 ::1 - 400 - id.domain.com POST - /api/oidc/token Go-http-client/1.1
in my access.log (filtered)
@savely-krasovsky commented on GitHub:
@stonith404 the Traefik feature you are showing is only available in Traefik Enterprise, 99% of self-hosters use community Traefik Proxy.
I believe it still should be configurable on per-client basis. A lot of apps doesn't support refresh tokens and cannot prolong session and some of them use access token directly without exchanging it with some sort of cookie (or even if they does, they sometime look at access token "ext" claim and set the same cookie lifetime). Locking it deliberately to 1h seems unreasonable to me.
@savely-krasovsky commented on GitHub:
After inspecting code it seems like session duration only affects duration of session in Pocket-ID itself. Access/Refresh/ID tokens lifetime is hardcoded and currently cannot be customized. To fix it it's better to make it configurable per-client.
@BizkitCake commented on GitHub:
@kmendell is there some other way to increase the duration of oidc clients token lifetime?
@kmendell commented on GitHub:
Im chnaging this to a feature request as it doesnt seem to be a bug.
@stonith404 commented on GitHub:
The "Session Duration" configuration is only for the session duration of Pocket ID, not for the clients, so that's expected.
OIDC clients usually don't rely on the session duration of the access token because they only use the access token once when the user signs in to retrieve its data. Are you sure that you don't have to configure this on the client side like in your case it should be configurable with the Traefik middleware.
That said, if the client relies on the access token for the session duration it should use the refresh token provided by Pocket ID, which expires after 30 days, to renew the access token.