fix(provider): add OAuth token refresh support for GitLab provider#9949
fix(provider): add OAuth token refresh support for GitLab provider#9949zerone0x wants to merge 1 commit intoanomalyco:devfrom
Conversation
Add automatic token refresh when GitLab OAuth tokens expire during a session. Previously, expired tokens would cause 401 errors without recovery. Changes: - Add `refresh` function to AuthHook interface in plugin types - Add `ProviderAuth.refresh()` to invoke plugin refresh logic - Add custom fetch in gitlab loader to handle token refresh: - Proactively refreshes expired tokens before requests - Retries on 401 "invalid_token" errors with refreshed token This requires the external GitLab auth plugin to implement the new `refresh` hook to provide the actual token refresh logic. Fixes anomalyco#9711 Co-Authored-By: Claude <noreply@anthropic.com>
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, no duplicate PRs found |
|
@zerone0x Thanks for the fix. I will wait until this PR has merged and add |
|
@rekram1-node Would you mind take a look at this PR, please? |
00637c0 to
71e0ba2
Compare
f1ae801 to
08fa7f7
Compare
|
Hey @rekram1-node , just wanted to bump this PR. The TOKEN_REFRESH_NEEDED error is a significant pain point when using opencode with GitLab Duo - it completely halts the session and requires a manual restart to re-authenticate, and seemingly even that doesn't always work as I'll restart opencode repeatedly and just be met with the same error. It's been a pretty huge pain point for me these past few weeks. |
|
This should be superseded by #13850 This PR fixes OAuth token refresh on Gitlab provider side. |
|
With #13850 merged and release, this issue has been fixed. |
What
Add automatic token refresh when GitLab OAuth tokens expire during a session.
How verified
refreshhook to the plugin interface that allows auth plugins to handle token refreshfetchnow:Changes
refreshfunction toAuthHookinterfaceProviderAuth.refresh()to invoke plugin refresh logicfetchin gitlab loader with token refresh handlingNote
This requires the external GitLab auth plugin (
@gitlab/opencode-gitlab-auth) to implement the newrefreshhook to provide the actual token refresh logic.Fixes #9711
🤖 Generated with Claude Code