MCPcopy
hub / github.com/PleasePrompto/notebooklm-skill / validate_auth

Method validate_auth

scripts/auth_manager.py:233–284  ·  view source on GitHub ↗

Validate that stored authentication works Uses persistent context to match actual usage pattern Returns: True if authentication is valid

(self)

Source from the content-addressed store, hash-verified

231 return self.setup_auth(headless, timeout_minutes)
232
233 def validate_auth(self) -> bool:
234 """
235 Validate that stored authentication works
236 Uses persistent context to match actual usage pattern
237
238 Returns:
239 True if authentication is valid
240 """
241 if not self.is_authenticated():
242 return False
243
244 print("🔍 Validating authentication...")
245
246 playwright = None
247 context = None
248
249 try:
250 playwright = sync_playwright().start()
251
252 # Launch using factory
253 context = BrowserFactory.launch_persistent_context(
254 playwright,
255 headless=True
256 )
257
258 # Try to access NotebookLM
259 page = context.new_page()
260 page.goto("https://notebooklm.google.com", wait_until="domcontentloaded", timeout=30000)
261
262 # Check if we can access NotebookLM
263 if "notebooklm.google.com" in page.url and "accounts.google.com" not in page.url:
264 print(" ✅ Authentication is valid")
265 return True
266 else:
267 print(" ❌ Authentication is invalid (redirected to login)")
268 return False
269
270 except Exception as e:
271 print(f" ❌ Validation failed: {e}")
272 return False
273
274 finally:
275 if context:
276 try:
277 context.close()
278 except Exception:
279 pass
280 if playwright:
281 try:
282 playwright.stop()
283 except Exception:
284 pass
285
286
287def main():

Callers 1

mainFunction · 0.95

Calls 3

is_authenticatedMethod · 0.95
closeMethod · 0.80

Tested by

no test coverage detected