# Fix token refresh for HTTP requests \(\#56559\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/54188321be129088de310855bc5e3b150a37530b)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 54188321be129088de310855bc5e3b150a37530b

Requested commit: 54188321be129088de310855bc5e3b150a37530b

Commit: 54188321be129088de310855bc5e3b150a37530b

Tree: 5a69c93acb9c3496ac338cca12c911c15311df24

Author: Conrad Irwin

Committer: GitHub

## Message

```
Fix token refresh for HTTP requests (#56559)

Code had been assuming (erroneously, but understandably) that
LlmApiToken::acquire would give them a valid token.

This is not true, as those tokens expire and you must call refresh
explicitly.

Add some helpers to do the retry for you, and rename acquire to cached
to be
clearer about the intent.

Closes #ISSUE

Release Notes:

- Fixed some rare cases where API requests would fail with Unauthorized
```

## Parents

- [64f624773f8b7cbcca99dfd89139262516fbc874](https://git.cafe/gitcafe/zed/commit/64f624773f8b7cbcca99dfd89139262516fbc874?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/54188321be129088de310855bc5e3b150a37530b?format=markdown)
