π OpenHands: AI-Driven Development
Minor auth fixes (#4699)
Robert Brennan36623a16da2a
diff --git a/frontend/src/api/open-hands.ts b/frontend/src/api/open-hands.tsindex 6f004862c2..6981848c7b 100644--- a/frontend/src/api/open-hands.ts+++ b/frontend/src/api/open-hands.ts@@ -141,9 +141,13 @@ class OpenHands {* @returns Response with authentication status and user info if successful*/static async authenticate(): Promise<Response> {- return request(`/api/authenticate`, {- method: "POST",- });+ return request(+ `/api/authenticate`,+ {+ method: "POST",+ },+ true,+ );}}diff --git a/frontend/src/routes/oauth.github.callback.tsx b/frontend/src/routes/oauth.github.callback.tsxindex 9232d9e222..b5bdca37e9 100644--- a/frontend/src/routes/oauth.github.callback.tsx+++ b/frontend/src/routes/oauth.github.callback.tsx@@ -15,14 +15,6 @@ export const clientLoader = async ({ request }: ClientLoaderFunctionArgs) => {await OpenHands.getGitHubAccessToken(code);localStorage.setItem("ghToken", accessToken);- const authResponse = await OpenHands.authenticate();- if (!authResponse.ok) {- localStorage.removeItem("ghToken");- return json(- { error: "Failed to authenticate with GitHub" },- { status: authResponse.status },- );- }return redirect("/");}diff --git a/frontend/src/services/api.ts b/frontend/src/services/api.tsindex dd67e2daf1..ab6006b6ab 100644--- a/frontend/src/services/api.ts+++ b/frontend/src/services/api.ts@@ -7,6 +7,7 @@ const UNAUTHED_ROUTE_PREFIXES = ["/api/authenticate","/api/options/","/config.json",+ "/api/github/callback",];export async function request(diff --git a/openhands/server/github.py b/openhands/server/github.pyindex 14ef93cfeb..31e88adc90 100644--- a/openhands/server/github.py+++ b/openhands/server/github.py@@ -76,11 +76,9 @@ class UserVerifier:return False-# Global instance of user verifier-user_verifier = UserVerifier()--async def authenticate_github_user(auth_token) -> bool:+ user_verifier = UserVerifier()+logger.info('Checking GitHub token')if not auth_token: