Skip to content

tests: renew the bearer token on 401 instead of checking it before each request - #4126

Open
v-scharf wants to merge 1 commit into
mainfrom
test/bearer-token-retry-on-401
Open

v-scharf wants to merge 1 commit into
mainfrom
test/bearer-token-retry-on-401

Conversation

@v-scharf

@v-scharf v-scharf commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

HttpRequestHelper::sendRequestOnce() sent a GET /graph/v1.0/me before every request to check the cached token, which doubled the number of requests.

Solution:

  • the request is now sent with the cached token right away (TokenHelper already renews it before it expires)
  • on a 401, sendRequest() clears the token cache and sends the request once more, e.g. when a server restart with another config invalidated the token
  • tests that expect a 401 still get it, at the cost of one more login
  • removes the retry while the share manager is migrating, which is no longer needed - fixed by @micbar

…ch request

Before each request with a bearer token, the test helper sent a
GET /graph/v1.0/me to check that the cached token is still valid, which
doubled the number of requests. Now the request is sent with the cached
token right away, and on a 401 the token is renewed and the request sent
once more.

Also drop the retry while the share manager is migrating, which is no
longer needed.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@v-scharf
v-scharf requested a review from saw-jan November 25, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants