Skip to content

πŸ™Œ OpenHands: AI-Driven Development

[Fix]: fetch latest token when existing token doesn't exist (#8000)

Rohit Malhotra986b90be0aa7
diff --git a/openhands/integrations/github/github_service.py b/openhands/integrations/github/github_service.py
index 70e91ca581..e74dfd2c26 100644
--- a/openhands/integrations/github/github_service.py
+++ b/openhands/integrations/github/github_service.py
@@ -47,7 +47,7 @@ class GitHubService(BaseGitService, GitService):
async def _get_github_headers(self) -> dict:
"""Retrieve the GH Token from settings store to construct the headers."""
- if self.user_id and not self.token:
+ if not self.token:
self.token = await self.get_latest_token()
return {
diff --git a/openhands/integrations/gitlab/gitlab_service.py b/openhands/integrations/gitlab/gitlab_service.py
index 3f7847f5b4..93a3e61fb8 100644
--- a/openhands/integrations/gitlab/gitlab_service.py
+++ b/openhands/integrations/gitlab/gitlab_service.py
@@ -48,7 +48,7 @@ class GitLabService(BaseGitService, GitService):
"""
Retrieve the GitLab Token to construct the headers
"""
- if self.user_id and not self.token:
+ if not self.token:
self.token = await self.get_latest_token()
return {