Skip to content

Retry token exchange on transient server errors #55

@zfarrell

Description

@zfarrell

The SDK's token-exchange path fails immediately on the first non-success response from the token endpoint (/v1/auth/jwt), with no retry. A brief, transient server-side error (e.g. a momentary 500) therefore fails the caller outright, even though an immediate re-attempt would succeed.

Ask: retry token exchange on transient failures before giving up.

  • Retry on 5xx responses and transport errors (connection/read errors).
  • Do not retry on 4xx (bad/expired credentials are not transient).
  • Use a small bounded retry budget with exponential backoff + jitter (e.g. 2-3 attempts).
  • Apply to both the initial mint and the refresh path.
  • Return the final error once retries are exhausted, preserving the last status/body.

For parity, this should match the equivalent change in sdk-python (filed alongside this).

Context on the server-side transient errors that motivated this: hotdata-dev/monopoly#1128.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions