Skip to content

Commit e0d8456

Browse files
authored
SNOW-673771 Print SSO URL before attempting to open window (#1393)
* Move sso url print statements to be before webbrowser.open
1 parent cb419e4 commit e0d8456

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/snowflake/connector/auth/webbrowser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ def prepare(
144144
)
145145

146146
logger.debug("step 2: open a browser")
147+
print(f"Going to open: {sso_url} to authenticate...")
147148
if not self._webbrowser.open_new(sso_url):
148149
print(
149150
"We were unable to open a browser window for you, "
150-
"please open the following url manually then paste the "
151+
"please open the url above manually then paste the "
151152
"URL you are redirected to into the terminal."
152153
)
153-
print(f"URL: {sso_url}")
154154
url = input("Enter the URL the SSO URL redirected you to: ")
155155
self._process_get_url(url)
156156
if not self._token:

test/unit/test_auth_webbrowser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ def test_auth_webbrowser_fail_webbrowser(
183183
"Initiating login request with your identity provider. A browser window "
184184
"should have opened for you to complete the login. If you can't see it, "
185185
"check existing browser windows, or your OS settings. Press CTRL+C to "
186-
"abort and try again...\nWe were unable to open a browser window for "
187-
"you, please open the following url manually then paste the URL you "
188-
f"are redirected to into the terminal.\nURL: {REF_SSO_URL}\n"
186+
f"abort and try again...\nGoing to open: {REF_SSO_URL} to authenticate...\nWe were unable to open a browser window for "
187+
"you, please open the url above manually then paste the URL you "
188+
"are redirected to into the terminal.\n"
189189
)
190190
if expected_error:
191191
assert rest._connection.errorhandler.called # an error
@@ -237,7 +237,7 @@ def test_auth_webbrowser_fail_webserver(capsys):
237237
"Initiating login request with your identity provider. A browser window "
238238
"should have opened for you to complete the login. If you can't see it, "
239239
"check existing browser windows, or your OS settings. Press CTRL+C to "
240-
"abort and try again...\n"
240+
f"abort and try again...\nGoing to open: {REF_SSO_URL} to authenticate...\n"
241241
)
242242
assert rest._connection.errorhandler.called # an error
243243
assert auth.assertion_content is None

0 commit comments

Comments
 (0)