You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check the `get_auth_token.py` script which prints the Auth Token that should be used **at this moment**, as this will be invalidated in at most 8 hours.
141
107
142
108
### Time Alignment
143
109
@@ -158,48 +124,29 @@ Each token is valid for 8 hours from its timestamp:
158
124
### API Key 253
159
125
160
126
We use API key index 253 because:
161
-
- It's the last available index (0-255)
162
-
- It's not typically used by other applications
127
+
- It's the last available index [0-253]
128
+
- It's not typically used by trading
163
129
- Easy to remember for this specific use case
130
+
- Easy to change and invalidate all tokens.
164
131
165
132
### Invalidating Tokens
166
133
167
134
To invalidate all existing tokens:
168
135
169
136
```bash
170
-
python3 setup.py >config.json
137
+
python3 setup.py config.json
171
138
```
172
139
173
140
Re-running the setup script generates new API keys for index 253, which invalidates all previously generated authentication tokens. This is useful if:
174
141
- You suspect your tokens have been compromised
175
-
- You want to rotate your API keys periodically
142
+
- You want to rotate your tokens periodically
176
143
- You need to revoke access immediately
177
144
178
145
### Best Practices
179
146
180
-
1.**Store tokens securely**: The `auth-tokens.json` file contains sensitive authentication data
181
-
2.**Regenerate regularly**: Set up a cron job to regenerate tokens periodically
182
-
3.**Monitor usage**: Keep track of which tokens are being used
183
-
4.**Separate keys**: Use different API keys for different purposes (253 for read-only)
184
-
185
-
## Example Workflow
186
-
187
-
Complete workflow for setting up and using pre-generated tokens:
188
-
189
-
```bash
190
-
# 1. Configure accounts (one-time setup)
191
-
cd examples/read-only-auth
192
-
python3 setup.py > config.json
193
-
194
-
# 2. Generate tokens for the next 7 days
195
-
python3 generate.py
147
+
1.**Store tokens securely**: The `auth-tokens.json` file contains sensitive data (read only, but still)
148
+
2.**Dedicated API key**: Use API key 253 for read-only token generation, as it can be invalidated easely.
196
149
197
-
# 3. Use the tokens in your application
198
-
python3 your_app.py # Uses auth-tokens.json
199
-
200
-
# 4. Regenerate tokens when needed (e.g., daily cron job)
201
-
python3 generate.py
202
-
```
203
150
204
151
## Troubleshooting
205
152
@@ -214,19 +161,8 @@ This could happen if:
214
161
- Network connectivity issues
215
162
- The account is not active
216
163
217
-
### "Token not found for timestamp" error
218
-
219
-
This means you don't have a token for the current time period. Run:
220
-
221
-
```bash
222
-
python3 generate.py
223
-
```
224
-
225
-
to generate fresh tokens.
226
-
227
164
## Additional Notes
228
165
229
166
- Tokens are specific to each account index
230
167
- Each account has its own set of time-aligned tokens
231
168
- The system uses the SignerClient's native `create_auth_token_with_expiry` method
232
-
- No modifications to the core lighter-python SDK are required
0 commit comments