Manually handle custom XDG protocol callback for Linux apps needing auth callbacks

In my case I’m trying to use plugin for vscode that requires you being signed in to an account. vscode can trigger the login window in the browser, but the callback from the browser to vscode doesn’t work because I don’t have an XDG protocol handler configured for vscode:// URLs due to the way I installed vscode (with flatpak).

Option 1: permanent fix

Register an XDG handler for the protocol: https://stackoverflow.com/a/77670791/1410035.

Option 2: one-off workaround

We can manually one-off pass the login callback to vscode without configuring anything long-term:

By doing this, we’ve recreated what a registered protocol handler would do.

Extra detail: as I’m using Flatpak, the auth was lost each time I closed vscode because the filesystem changes weren’t persistent. To fix that, I:

comments powered by Disqus