Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

earlier only check is made for web but it would be true only incase of web application oauth, not in case of other like desktop application

DavdaJames4952c493440e
diff --git a/examples/integrations/gmail_2fa_integration.py b/examples/integrations/gmail_2fa_integration.py
index 7ca4c5fc1..1a27f8652 100644
--- a/examples/integrations/gmail_2fa_integration.py
+++ b/examples/integrations/gmail_2fa_integration.py
@@ -68,12 +68,10 @@ class GmailGrantManager:
with open(self.credentials_file) as f:
creds = json.load(f)
- required_fields = ['web']
- web = creds['web']
- if not web:
- return False, "Invalid credentials format - missing 'web' section"
-
- return True, 'Credentials file is valid'
+ # Accept if either 'web' or 'installed' section exists and is not empty
+ if creds.get('web') or creds.get('installed'):
+ return True, 'Credentials file is valid'
+ return False, "Invalid credentials format - neither 'web' nor 'installed' sections found"
except json.JSONDecodeError:
return False, 'Credentials file is not valid JSON'