mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
extract token from localStorage after logging in
This commit is contained in:
parent
defce34263
commit
4d641af0c1
1 changed files with 13 additions and 1 deletions
|
|
@ -40,7 +40,19 @@ def handler(event: Mapping[str, Any], context: Any) -> Dict[str, str]:
|
|||
|
||||
logger.info(f"Login likely successful. URL: {page.url}")
|
||||
|
||||
return {"status": "ok"}
|
||||
token = page.evaluate(
|
||||
"""() => {
|
||||
return localStorage.getItem('token');
|
||||
}"""
|
||||
)
|
||||
|
||||
if not token:
|
||||
logger.error("Login succeeded but no token found")
|
||||
return {"status": "error", "message": "No token found"}
|
||||
|
||||
logger.info(f"Token extracted successfully: {token}")
|
||||
|
||||
return {"status": "ok", "token": token}
|
||||
|
||||
except PlaywrightTimeoutError as e:
|
||||
logger.error(f"Timeout during login flow: {str(e)}")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue