Skip to content

feat: Refresh token during active user sessions#1391

Open
solracsf wants to merge 1 commit intomainfrom
refreshTokenImplement
Open

feat: Refresh token during active user sessions#1391
solracsf wants to merge 1 commit intomainfrom
refreshTokenImplement

Conversation

@solracsf
Copy link
Copy Markdown
Member

@solracsf solracsf commented Mar 27, 2026

Resolves #1384

How it works end-to-end:

  • Token lifetime is e.g. 300s. After 150s (isExpiring() threshold), the next Nextcloud request triggers a proactive refresh_token call to IdP.
    return time() > ($this->createdAt + (int)($this->expiresIn / 2));
  • IdP resets its SSO session idle timer on that token endpoint call.
  • The existing locking mechanism ensures concurrent requests don't hammer the IdP (only one refresh happens per session, others wait and reuse the result).
  • No new settings needed: the behavior is gated entirely on the existing store_login_token setting and a non-null refresh token.

No breaking changes to the public API, no behavior change for non-OIDC sessions, and no behavior change when store_login_token is disabled.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf solracsf added 3. to review enhancement New feature or request labels Mar 27, 2026
Copy link
Copy Markdown
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@solracsf solracsf requested a review from julien-nc March 30, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refresh OIDC token periodically during active user sessions

2 participants