Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSAL] Can't sign in in a browser codespace #236825

Closed
winstliu opened this issue Dec 22, 2024 · 2 comments · Fixed by #237006
Closed

[MSAL] Can't sign in in a browser codespace #236825

winstliu opened this issue Dec 22, 2024 · 2 comments · Fixed by #237006
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders
Milestone

Comments

@winstliu
Copy link
Member

winstliu commented Dec 22, 2024

Does this issue occur when all extensions are disabled?: I don't know how to start with --disable-extensions in a codespace, but I don't expect that to matter.

Version: 1.96.2
Commit: fabdb6a
Date: 2024-12-19T10:22:47.216Z
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0

Sorry, here's another one...

Steps to Reproduce:

  1. Open a GitHub Codespace in the browser
  2. Set "microsoft-authentication.implementation": "msal"
  3. Try to sign in using a Microsoft account (Sync Settings, Azure Repos, etc)

Expected: I can sign in

Actual: After signing in on the new browser tab it creates, I get redirected to a localhost page that doesn't connect, and the Codespace continues to say "Signing in to Microsoft...". The backup protocol handler option also doesn't seem to do anything.

localhost-not-available

(I'm not sure if this is a supported MSAL scenario yet? #178740 only discusses vscode.dev so I can't tell)

Microsoft Authentication
2024-12-22 19:41:11.070 [info] Acquired MSAL enablement value from 'globalValue'. Value: msal
2024-12-22 19:41:11.070 [debug] [initialize] Initializing PublicClientApplicationManager
2024-12-22 19:41:12.904 [warning] [Sun, 22 Dec 2024 19:41:12 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Warning - NativeBroker implementation was provided but the broker is unavailable.
2024-12-22 19:41:12.904 [debug] [update] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] CachedPublicClientApplication update before: 0
2024-12-22 19:41:12.904 [debug] [Sun, 22 Dec 2024 19:41:12 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Info - getTokenCache called
2024-12-22 19:41:13.375 [debug] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-common@14.16.0 : Info - CacheManager:getIdToken - Returning ID token
2024-12-22 19:41:13.376 [debug] [update] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] CachedPublicClientApplication update after: 1
2024-12-22 19:41:13.376 [debug] [update] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] CachedPublicClientApplication accounts changed. added: 1, deleted: 0
2024-12-22 19:41:13.376 [debug] [update] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] CachedPublicClientApplication update complete
2024-12-22 19:41:13.380 [debug] [initialize] PublicClientApplicationManager initialized
2024-12-22 19:41:13.381 [debug] [_handleAccountChange] added: 1, changed: 0, deleted: 0
2024-12-22 19:41:13.709 [info] [getSessions] [all] starting
2024-12-22 19:41:13.710 [info] [getSessions] [all] returned 1 session(s)
2024-12-22 19:41:13.710 [info] [getSessions] [all] starting
2024-12-22 19:41:13.710 [info] [getSessions] [all] returned 1 session(s)
2024-12-22 19:41:13.710 [info] [getSessions] [email offline_access openid profile] starting
2024-12-22 19:41:13.712 [debug] [getOrCreate] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] PublicClientApplicationManager cache hit
2024-12-22 19:41:13.713 [debug] [acquireTokenSilent] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] [email offline_access openid profile User.Read] [winstonliu@microsoft.com] starting...
2024-12-22 19:41:13.714 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - initializeRequestScopes called
2024-12-22 19:41:13.716 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [48d59f39-6fb3-49a3-b360-2e79a470cd68] : @azure/msal-node@2.16.2 : Verbose - buildOauthClientConfiguration called
2024-12-22 19:41:13.716 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [48d59f39-6fb3-49a3-b360-2e79a470cd68] : @azure/msal-node@2.16.2 : Verbose - createAuthority called
2024-12-22 19:41:13.717 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Attempting to get cloud discovery metadata  from authority configuration
2024-12-22 19:41:13.717 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values.
2024-12-22 19:41:13.717 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Found cloud discovery metadata from hardcoded values.
2024-12-22 19:41:13.718 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Attempting to get endpoint metadata from authority configuration
2024-12-22 19:41:13.718 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values.
2024-12-22 19:41:13.719 [debug] [Sun, 22 Dec 2024 19:41:13 GMT] : [48d59f39-6fb3-49a3-b360-2e79a470cd68] : @azure/msal-node@2.16.2 : Info - Building oauth client configuration with the following authority: https://login.microsoftonline.com/organizations/oauth2/v2.0/token.
2024-12-22 19:41:13.723 [trace] [Sun, 22 Dec 2024 19:41:13 GMT] : [48d59f39-6fb3-49a3-b360-2e79a470cd68] : @azure/msal-node@2.16.2 : Verbose - Silent flow client created
2024-12-22 19:41:13.724 [debug] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-common@14.16.0 : Info - CacheManager:getAccessToken - Returning access token
2024-12-22 19:41:13.724 [debug] [Sun, 22 Dec 2024 19:41:13 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-common@14.16.0 : Info - CacheManager:getIdToken - Returning ID token
2024-12-22 19:41:13.724 [debug] [acquireTokenSilent] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] [email offline_access openid profile User.Read] [winstonliu@microsoft.com] got result
2024-12-22 19:41:13.724 [info] [getSessions] [email offline_access openid profile] returned 1 session(s)
2024-12-22 19:41:14.284 [info] [getSessions] [all] starting
2024-12-22 19:41:14.284 [info] [getSessions] [all] returned 1 session(s)
2024-12-22 19:41:36.298 [info] [createSession] [email offline_access openid profile] starting
2024-12-22 19:41:36.298 [debug] [getOrCreate] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] PublicClientApplicationManager cache hit
2024-12-22 19:41:36.314 [debug] [acquireTokenInteractive] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] [email offline_access openid profile User.Read] loopbackClientOverride: false
2024-12-22 19:41:36.517 [debug] [Sun, 22 Dec 2024 19:41:36 GMT] : [08dfb6d9-80cc-422f-8223-e98075fba9c9] : @azure/msal-node@2.16.2 : Info - getAuthCodeUrl called
2024-12-22 19:41:36.517 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [08dfb6d9-80cc-422f-8223-e98075fba9c9] : @azure/msal-node@2.16.2 : Verbose - initializeRequestScopes called
2024-12-22 19:41:36.518 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [08dfb6d9-80cc-422f-8223-e98075fba9c9] : @azure/msal-node@2.16.2 : Verbose - buildOauthClientConfiguration called
2024-12-22 19:41:36.518 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [08dfb6d9-80cc-422f-8223-e98075fba9c9] : @azure/msal-node@2.16.2 : Verbose - createAuthority called
2024-12-22 19:41:36.518 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Attempting to get cloud discovery metadata  from authority configuration
2024-12-22 19:41:36.518 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values.
2024-12-22 19:41:36.518 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Found cloud discovery metadata from hardcoded values.
2024-12-22 19:41:36.518 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Attempting to get endpoint metadata from authority configuration
2024-12-22 19:41:36.518 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] : @azure/msal-node@2.16.2 : Verbose - Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values.
2024-12-22 19:41:36.518 [debug] [Sun, 22 Dec 2024 19:41:36 GMT] : [08dfb6d9-80cc-422f-8223-e98075fba9c9] : @azure/msal-node@2.16.2 : Info - Building oauth client configuration with the following authority: https://login.microsoftonline.com/organizations/oauth2/v2.0/token.
2024-12-22 19:41:36.519 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [08dfb6d9-80cc-422f-8223-e98075fba9c9] : @azure/msal-node@2.16.2 : Verbose - Auth code client created
2024-12-22 19:41:36.519 [trace] [Sun, 22 Dec 2024 19:41:36 GMT] : [08dfb6d9-80cc-422f-8223-e98075fba9c9] : @azure/msal-common@14.16.0 : Verbose - createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints
2024-12-22 19:41:49.460 [debug] [acquireTokenInteractive] [aebc6443-996d-45c2-90f0-388ff96faa56] [https://login.microsoftonline.com/organizations] [email offline_access openid profile User.Read] loopbackClientOverride: true
Window
2024-12-22 14:40:47.789 [info] Resolving connection token (codespaces)...
2024-12-22 14:40:47.857 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-vscode.vscode-selfhost-test-provider' wants API proposal 'attributableCoverage' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
2024-12-22 14:40:47.857 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-python.python' wants API proposal 'contribIssueReporter' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
2024-12-22 14:40:47.857 [warning] Via 'product.json#extensionEnabledApiProposals' extension 'ms-python.debugpy' wants API proposal 'contribIssueReporter' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
2024-12-22 14:40:53.376 [info] Updating additional builtin extensions cache
2024-12-22 14:41:00.885 [info] Resolved connection token (codespaces) after 13096 ms
2024-12-22 14:41:00.887 [info] Creating a socket (renderer-Management-f190c0cc-251d-47e3-bbac-00273f7615b8)...
2024-12-22 14:41:00.897 [info] Creating a socket (renderer-ExtensionHost-8e1b0fdc-9db7-4fcf-969f-1f32c201bdc8)...
2024-12-22 14:41:01.216 [info] Creating a socket (renderer-Management-f190c0cc-251d-47e3-bbac-00273f7615b8) was successful after 329 ms.
2024-12-22 14:41:01.273 [info] Creating a socket (renderer-ExtensionHost-8e1b0fdc-9db7-4fcf-969f-1f32c201bdc8) was successful after 376 ms.
2024-12-22 14:41:04.105 [error] Extension 'ms-vscode.vscode-selfhost-test-provider' wants API proposal 'attributableCoverage' but that proposal DOES NOT EXIST. Likely, the proposal has been finalized (check 'vscode.d.ts') or was abandoned.
2024-12-22 14:41:04.222 [warning] [twxs.cmake]: Cannot register 'cmake.cmakePath'. This property is already registered.
2024-12-22 14:41:14.610 [info] Settings Sync: Account status changed from uninitialized to unavailable
2024-12-22 14:41:22.799 [info] Extension host (Remote) is unresponsive.
2024-12-22 14:41:24.182 [info] Extension host (Remote) is responsive.
2024-12-22 14:41:31.683 [error] [Extension Host] (node:686) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
@winstliu winstliu changed the title [MSAL] Can't sign into Sync Settings in a browser codespace [MSAL] Can't sign in in a browser codespace Dec 22, 2024
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Dec 27, 2024

Two things:

  1. we shouldn't do the localhost flow when running in Codespaces, we should use the Protocol Handler flow. Fixed in Adopt concept of flows in Microsoft Auth #237006 ultimately fixing this issue
  2. the fact that the protocol handler doesn't even start leads me to believe there is yet another MSAL bug... that basically disallows 2 interactive flows at the same time.... so I need to figure out what to do about that. Also, this only seems to be an issue when not using the broker.

@vs-code-engineering vs-code-engineering bot added the unreleased Patch has not yet been released in VS Code Insiders label Dec 27, 2024
@vs-code-engineering vs-code-engineering bot added this to the January 2025 milestone Dec 27, 2024
TylerLeonhardt added a commit that referenced this issue Dec 28, 2024
When we cancel, then the promise should be cancelled. If we don't do this, we hang on the first interaction request until we timeout.

Fixes the 2nd point in #236825 (comment)
@TylerLeonhardt
Copy link
Member

jk it was my fault :) #237029 should fix

TylerLeonhardt added a commit that referenced this issue Dec 28, 2024
When we cancel, then the promise should be cancelled. If we don't do this, we hang on the first interaction request until we timeout.

Fixes the 2nd point in #236825 (comment)
@vs-code-engineering vs-code-engineering bot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
insiders-released Patch has been released in VS Code Insiders
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants