added support for logging-in with refresh tokens, deployed as 0.0.21
parent
2d1a76b9ff
commit
38f3649a47
|
@ -1,5 +1,5 @@
|
|||
""" Python client for Eagle Eye Networks APIv3 """
|
||||
version = "0.0.20"
|
||||
version = "0.0.21"
|
||||
__version__ = version
|
||||
|
||||
|
||||
|
@ -127,8 +127,7 @@ class EagleEyev3():
|
|||
else:
|
||||
return (ts - timedelta(hours=hours)).isoformat(timespec='milliseconds')
|
||||
|
||||
|
||||
def login_tokens(self, code=None, cascade=True):
|
||||
def login_tokens(self, code=None, cascade=True, refresh_token=None):
|
||||
"""
|
||||
Obtains login tokens using the authorization code.
|
||||
|
||||
|
@ -140,7 +139,11 @@ class EagleEyev3():
|
|||
dict: Dictionary containing the success status, response HTTP status code, data, and current user information.
|
||||
"""
|
||||
baseUrl = "https://auth.eagleeyenetworks.com/oauth2/token"
|
||||
pathUrl = f"?grant_type=authorization_code&scope=vms.all&code={code}&redirect_uri={self.redirect_uri}" # Note the trailing slash, make sure it matches the whitelist
|
||||
if refresh_token:
|
||||
pathUrl = f"?grant_type=refresh_token&refresh_token={refresh_token}"
|
||||
else:
|
||||
pathUrl = f"?grant_type=authorization_code&scope=vms.all&code={code}&redirect_uri={self.redirect_uri}" # Note the trailing slash, make sure it matches the whitelist
|
||||
|
||||
url = baseUrl + pathUrl
|
||||
|
||||
# Send a POST request to obtain login tokens
|
||||
|
|
Loading…
Reference in New Issue