@thierryteisseire/leadgenius-skill 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +2 -2
- package/package.json +1 -1
- package/scripts/auth.py +6 -3
- package/scripts/lgp.py +18 -7
package/SKILL.md
CHANGED
|
@@ -57,8 +57,8 @@ The primary way to interact with LeadGenius is via the `lgp` CLI tool.
|
|
|
57
57
|
|
|
58
58
|
#### 1. Setup & Auth
|
|
59
59
|
Authentication is a two-step process:
|
|
60
|
-
1. **Login**: Authenticate with your email and password to get a temporary session.
|
|
61
|
-
2. **Generate Key**: Create a long-lived API Key (`lgp_...`) for your scripts/agent.
|
|
60
|
+
1. **Login**: Authenticate with your email and password to get a temporary session (JWTokens are stored).
|
|
61
|
+
2. **Generate Key**: Create a long-lived API Key (`lgp_...`) for your scripts/agent using the session.
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
# 1. Login to get session (email/password)
|
package/package.json
CHANGED
package/scripts/auth.py
CHANGED
|
@@ -21,20 +21,22 @@ def main():
|
|
|
21
21
|
email = args.email or input("Email: ")
|
|
22
22
|
password = args.password or getpass("Password: ")
|
|
23
23
|
|
|
24
|
-
url = f"{args.base_url.rstrip('/')}/api/
|
|
24
|
+
url = f"{args.base_url.rstrip('/')}/api/auth"
|
|
25
25
|
|
|
26
26
|
print(f"Authenticating with {url}...")
|
|
27
27
|
|
|
28
28
|
try:
|
|
29
29
|
response = requests.post(
|
|
30
30
|
url,
|
|
31
|
-
json={"
|
|
31
|
+
json={"username": email, "password": password},
|
|
32
32
|
headers={"Content-Type": "application/json"}
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
if response.status_code == 200:
|
|
36
36
|
data = response.json()
|
|
37
|
-
|
|
37
|
+
tokens = data.get("tokens", {})
|
|
38
|
+
token = tokens.get("accessToken")
|
|
39
|
+
refresh_token = tokens.get("refreshToken")
|
|
38
40
|
|
|
39
41
|
if not token:
|
|
40
42
|
print("Error: Authentication succeeded but no token was returned.")
|
|
@@ -45,6 +47,7 @@ def main():
|
|
|
45
47
|
if args.save:
|
|
46
48
|
auth_data = {
|
|
47
49
|
"token": token,
|
|
50
|
+
"refresh_token": refresh_token,
|
|
48
51
|
"email": email,
|
|
49
52
|
"base_url": args.base_url
|
|
50
53
|
}
|
package/scripts/lgp.py
CHANGED
|
@@ -80,17 +80,28 @@ class LeadGeniusCLI:
|
|
|
80
80
|
email = email or input("Email: ")
|
|
81
81
|
password = password or getpass("Password: ")
|
|
82
82
|
|
|
83
|
-
url = f"{self.base_url}/api/
|
|
83
|
+
url = f"{self.base_url}/api/auth"
|
|
84
84
|
try:
|
|
85
|
-
response = requests.post(url, json={"
|
|
85
|
+
response = requests.post(url, json={"username": email, "password": password})
|
|
86
86
|
if response.status_code == 200:
|
|
87
87
|
data = response.json()
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
tokens = data.get("tokens", {})
|
|
89
|
+
jwt_token = tokens.get("accessToken")
|
|
90
|
+
refresh_token = tokens.get("refreshToken")
|
|
91
|
+
|
|
92
|
+
if not jwt_token:
|
|
93
|
+
print("Error: Auth succeeded but no accessToken found.")
|
|
94
|
+
return
|
|
95
|
+
|
|
96
|
+
# Save JWT (and refresh token)
|
|
97
|
+
# We save JWT strictly to allow `generate-key` to work next, or as fallback.
|
|
92
98
|
with open(AUTH_FILE, "w") as f:
|
|
93
|
-
json.dump({
|
|
99
|
+
json.dump({
|
|
100
|
+
"token": jwt_token,
|
|
101
|
+
"refresh_token": refresh_token,
|
|
102
|
+
"email": email,
|
|
103
|
+
"base_url": self.base_url
|
|
104
|
+
}, f)
|
|
94
105
|
print(f"Successfully authenticated as {email}")
|
|
95
106
|
print("IMPORTANT: Most commands now require an API Key.")
|
|
96
107
|
print("Run 'lgp generate-key' to create one.")
|