Skip to content

fix(db_perform_request/response): refresh bearer token manually with margin - #254

Closed
max607 wants to merge 1 commit into
databrickslabs:mainfrom
max607:fix/token-expiry
Closed

fix(db_perform_request/response): refresh bearer token manually with margin#254
max607 wants to merge 1 commit into
databrickslabs:mainfrom
max607:fix/token-expiry

Conversation

@max607

@max607 max607 commented Jul 10, 2026

Copy link
Copy Markdown

The Databricks API rejects tokens that will expire in <30s with the error 403 "Token is expiring within 30 seconds. (token expired)". This results in an error as httr2 only refreshes expired tokens.

This issue is similar, e.g., to this PR for the Databricks SDK in Go.

@CLAassistant

CLAassistant commented Jul 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@m-muecke

Copy link
Copy Markdown
Contributor

I think this would be easier if httr2 would introduce a buffer param for the expiry time since other use-cases might hit the same issue.

@zacdav-db

Copy link
Copy Markdown
Collaborator

I'm inclined to agree with @m-muecke, this is a slightly annoying behaviour from Databricks API side that is a bit clunky to handle.

I'll have a think and review again early next week and assess if it is something httr2 is open to merging.

@zacdav-db

Copy link
Copy Markdown
Collaborator

This is now tracked upstream in httr2:

The proposed fix adds a configurable OAuth expiry margin, allowing brickster to refresh tokens early without clearing httr2 private cache state.

@zacdav-db

Copy link
Copy Markdown
Collaborator

Now that r-lib/httr2#861 is merged, I'll address this in a separate PR as soon as it reaches CRAN and can update dependencies version + code.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants