Bug 1866233 - Open the web browser when the token needs to be refreshed. r=sheehan

Differential Revision: https://phabricator.services.mozilla.com/D194472
This commit is contained in:
Paul Adenot 2023-11-27 10:03:45 +00:00
parent ae937fe800
commit a510d60572

View file

@ -14,6 +14,7 @@ import configparser
import json
import os
import time
import webbrowser
from dataclasses import (
dataclass,
field,
@ -234,6 +235,11 @@ class Auth0Config:
auth_msg = f"Auth0 token validation required at: {device_code_data['verification_uri_complete']}"
build.notify(auth_msg)
try:
webbrowser.open(device_code_data['verification_uri_complete'])
except webbrowser.Error:
print("Could not automatically open the web browser.")
device_code_lifetime_s = device_code_data["expires_in"]
# Print successive periods on the same line to avoid moving the link