Skip to content

Fix upstream token storage TTL for refresh-token-bearing entries #3914

Closed

Description

@jhrozek

Summary

StoreUpstreamTokens sets the storage entry's TTL to the upstream access token's ExpiresAt (~1h). This garbage-collects the refresh token along with the expired access token, even though the refresh token may be valid for 30+ days.

What

Change StoreUpstreamTokens TTL logic:

  • If the entry has a refresh token: TTL = now + 2h (sliding inactivity window)
  • If no refresh token: TTL = ExpiresAt (unchanged)

Add DefaultUpstreamInactivityTimeout constant.

Why

This is a prerequisite for upstream token refresh — without it, there's nothing left to refresh by the time anyone tries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

authenticationbugsize/S

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions