Use secrets module to generate token nonce
This commit is contained in:
parent
654a123458
commit
6d371c13d7
1 changed files with 2 additions and 2 deletions
|
|
@ -1,9 +1,9 @@
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import time
|
|
||||||
|
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
from secrets import token_urlsafe
|
||||||
from typing import Generator
|
from typing import Generator
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
@ -28,7 +28,7 @@ def _get_token(private_key_path: str, login: str, api_url: str) -> str:
|
||||||
f"{api_url}/auth",
|
f"{api_url}/auth",
|
||||||
json={
|
json={
|
||||||
"login": login,
|
"login": login,
|
||||||
"nonce": str(int(time.time() * 1000)),
|
"nonce": token_urlsafe(),
|
||||||
"read_only": False,
|
"read_only": False,
|
||||||
"expiration_time": "30 minutes",
|
"expiration_time": "30 minutes",
|
||||||
"label": "Trans IP client",
|
"label": "Trans IP client",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue