microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.94k stars 28.77k forks source link

Warn when auth extension is disabled #147916

Open Nevon opened 2 years ago

Nevon commented 2 years ago

Issue Type: Bug

  1. Cmd + P -> "Live Share: Sign in"
  2. Select "Sign in with Microsoft account"
  3. Nothing happens for a few seconds
  4. Get a popup with the following error message: "Signing in: Auth token returned by microsoft provider is empty."

I never go through any sign in process and vscode does not open a browser window for me to sign in, which leads me to believe that maybe there's some invalid value stored in the extension context. I have previously been able to use Live Share for months. It only stopped working recently. I have not been able to figure out how I can clear the secret storage for an extension. Reinstalling the extension does not solve the issue, nor does reinstalling vscode itself, presumably because of #123817.

If I do the same thing using Insiders it works, so either there's a bug that's been fixed in Insiders without me being able to find any related issue or PR, or I have some messed up state that isn't shared between Code and Insiders.

EDIT: Indeed, moving ~/Library/Application Support/Code to another location fixes it, but then I also lose all my settings and such, which is what I'm trying to avoid. How can I delete just the storage for the Microsoft authentication?

VS Code version: Code 1.66.2 (Universal) (dfd34e8260c270da74b5c2d86d61aee4b6d56977, 2022-04-11T07:49:20.994Z) OS version: Darwin x64 21.4.0 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|5, 4, 4| |Memory (System)|16.00GB (0.02GB free)| |Process Argv|--crash-reporter-id f07fdb15-d771-43b9-9481-f9f22ad749e3| |Screen Reader|no| |VM|0%|
Extensions (6) Extension|Author (truncated)|Version ---|---|--- github-markdown-preview|bie|0.2.0 vscode-eslint|dba|2.2.2 prettier-vscode|esb|9.5.0 vsliveshare|ms-|1.0.5527 vsliveshare-audio|ms-|0.1.91 vsliveshare-pack|ms-|0.4.0
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30443607 pythontb:30283811 pythonvspyt551:30345470 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805cf:30301675 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 pythonvsnew555:30457759 vscscmwlcmt:30465135 cppdebug:30475216 ```
TylerLeonhardt commented 2 years ago

@Nevon in the account menu in the bottom left above the gear... when you click on that, do you see any Microsoft accounts listed?

If so, can you drill into the Microsoft session and sign out of it?

Let me know if you need me to attach screenshots.

Nevon commented 2 years ago

No, there was no existing microsoft session in there.

TylerLeonhardt commented 2 years ago

@Nevon Can you provide the contents of the Microsoft Authentication output pane: image

And also anything that shows up in Dev Tools:

Nevon commented 2 years ago

I don't have any such output channel:

Screenshot 2022-04-22 at 16 30 06

This is what's in the devtools. The last line is logged when I try to initiate the sign-in, after a few seconds:

Screenshot 2022-04-22 at 16 30 40
TylerLeonhardt commented 2 years ago

This is odd to me... it seems that the Microsoft Account extension never started. Can you share me what's in your settings? (Open Settings JSON in the command palette)

Nevon commented 2 years ago
{
    "liveshare.anonymousGuestApproval": "reject",
    "liveshare.guestApprovalRequired": true,
    "explorer.compactFolders": false,
    "files.associations": {
        "*.hcl": "terraform"
    },
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter-notebook"
    },
    "markdown-preview-github-styles.colorTheme": "light",
    "[json]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "editor.inlineSuggest.enabled": true,
    "github.copilot.enable": {
        "*": true,
        "yaml": false,
        "plaintext": true,
        "markdown": true
    },
    "jest.autoRun": "off",
    "[jsonc]": {
        "editor.defaultFormatter": "vscode.json-language-features"
    },
    "[javascript]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    },
    "hexeditor.columnWidth": 16,
    "hexeditor.showDecodedText": true,
    "hexeditor.defaultEndianness": "little",
    "hexeditor.inspectorType": "aside",
    "window.zoomLevel": 4
}
TylerLeonhardt commented 2 years ago

nothing interesting in there... two more things to gather info on this issue:

  1. Run the command Extensions: Show built-in extensions and look for Microsoft Account in the Features list. If the extension started, it should show a little number like so. Do you see one for that extension?: image

  2. Can you sign in to Settings Sync using your Microsoft account and see if that works and you're able to go through the flow ok?

Nevon commented 2 years ago

Seems like we found the issue. The built-in Microsoft extension was disabled. I have no recollection of ever disabling it, since I didn't even know it existed, but enabling it seems to have solved the problem at least.

So if that's the issue, then I guess this is more a question of surfacing the error in a better way, since even though the extension was disabled I could still choose to sign in with microsoft for live share.

TylerLeonhardt commented 2 years ago

Bizarre... yeah I agree that we can probably be a bit better with our error there.

stgarf-sx commented 1 year ago

I am hitting this issue but in my case I do not have the "Microsoft Account" built-in disabled.

image

However, the "Microsoft Authentication" page has some ominous sounding errors that I have no idea how to resolve.

2022-12-13 16:31:32.937 [error] Error exchanging code for token (for scopes 9bd5ab7f-4031-4045-ace9-6bebbad202f6/all email offline_access openid profile): Error: {"error":"invalid_request","error_description":"AADSTS900434: National Cloud request processing failed: CallNationalCloud: http request failed with errorcode: BadRequest, Content:{\"error\":\"invalid_request\",\"error_description\":\"AADSTS54006: Unencrypted v2 access tokens are not supported for first party applications that support consumer accounts. The resource must add a certificate to the onboarding portal to encrypt tokens.\\r\\nTrace ID: b1730db1-4f21-4f8b-9b3f-2ba166299d00\\r\\nCorrelation ID: 4ac1de57-14d3-46ef-853e-6e4d77e3bf63\\r\\nTimestamp: 2022-12-14 00:31:32Z\",\"error_codes\":[54006],\"timestamp\":\"2022-12-14 00:31:32Z\",\"trace_id\":\"b1730db1-4f21-4f8b-9b3f-2ba166299d00\",\"correlation_id\":\"4ac1de57-14d3-46ef-853e-6e4d77e3bf63\"}.\r\nTrace ID: 9e049cd7-e2eb-4d15-9c6e-a9f17c9b0800\r\nCorrelation ID: 4ac1de57-14d3-46ef-853e-6e4d77e3bf63\r\nTimestamp: 2022-12-14 00:31:32Z","error_codes":[900434],"timestamp":"2022-12-14 00:31:32Z","trace_id":"9e049cd7-e2eb-4d15-9c6e-a9f17c9b0800","correlation_id":"4ac1de57-14d3-46ef-853e-6e4d77e3bf63"}
TylerLeonhardt commented 1 year ago

@stgarf-sx what kind of account are you using to log in?

stgarf-sx commented 1 year ago

A Microsoft account if I am not mistaken? I'm not sure I understand the question outside of that.

TylerLeonhardt commented 1 year ago

@stgarf-sx so this is your personal Microsoft account, yes? Not some work account?

stgarf-sx commented 1 year ago

Ah, I see what you're driving at. No it's not a personal account it's indeed a work account.

TylerLeonhardt commented 1 year ago

@stgarf-sx since your error message is different, let's track your issue in a new issue. https://github.com/microsoft/vscode/issues/169152