diff --git a/EagleEyev3/__init__.py b/EagleEyev3/__init__.py
index 745b52a..ddbef71 100644
--- a/EagleEyev3/__init__.py
+++ b/EagleEyev3/__init__.py
@@ -57,7 +57,7 @@ class EagleEyev3():
# Combine server_protocol, server_host, and server_port to make the redirect_uri
# Note: Please see the note in settings.py about trailing slashes and modify this line if needed
- self.redirect_uri = f"{settings.server_protocol}://{settings.server_host}:{settings.server_port}"
+ self.redirect_uri = f"{settings.server_protocol}://{settings.server_host}:{settings.server_port}/login_callback"
def _save_access_token(self):
with open(".lazy_login", "w") as json_file:
diff --git a/server.py b/server.py
index c7dd322..7277c9a 100644
--- a/server.py
+++ b/server.py
@@ -12,17 +12,22 @@ def index():
# This is getting the ?code= querystring value from the HTTP request.
code = request.args.get('code')
+ base_url = "https://auth.eagleeyenetworks.com/oauth2/authorize"
+ path_url = f"?client_id={een.client_id}&response_type=code&scope=vms.all&redirect_uri={een.redirect_uri}"
+
+ request_auth_url = f"{base_url}{path_url}"
+
+ return "Login with Eagle Eye Networks"
+
+@app.route('/login_callback')
+def login_callback():
+ # This is getting the ?code= querystring value from the HTTP request.
+ code = request.args.get('code')
+
if (code):
oauth_object = een.login_tokens(code)
return f"Hello {een.current_user['firstName']} {een.current_user['lastName']}"
- else:
- base_url = "https://auth.eagleeyenetworks.com/oauth2/authorize"
- path_url = f"?client_id={een.client_id}&response_type=code&scope=vms.all&redirect_uri={een.redirect_uri}"
-
- request_auth_url = f"{base_url}{path_url}"
-
- return "Login with Eagle Eye Networks"
if __name__ == '__main__':