-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstore_cookie.py
More file actions
39 lines (29 loc) · 1.05 KB
/
store_cookie.py
File metadata and controls
39 lines (29 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
"""Force authentication and store LinkedIn cookie."""
import os
from linkedin_mcp_server.authentication import store_authentication
from linkedin_mcp_server.drivers.chrome import get_or_create_driver
def main():
# Get cookie from environment
cookie = os.getenv("LINKEDIN_COOKIE")
if not cookie:
print("❌ No LINKEDIN_COOKIE environment variable found")
print("Run: export LINKEDIN_COOKIE='li_at=YOUR_COOKIE'")
return
try:
# Store the cookie
success = store_authentication(cookie)
if success:
print("✅ Cookie stored in keychain")
# Test authentication by creating driver
print("🔄 Testing authentication...")
driver = get_or_create_driver(cookie)
print("✅ Authentication successful!")
# Clean up
driver.quit()
else:
print("❌ Failed to store cookie")
except Exception as e:
print(f"❌ Authentication failed: {e}")
if __name__ == "__main__":
main()