'How do I get an oAuth web token from the browser to my VS Code extension?

There are lots of questions asking how to open the browser from VS Code. But I'm looking for the opposite thing. I have an oAuth token that I'm console logging on the browser, and want to store it on VS Code.

I have a very simple "Login with GitHub" app. Right now it executes all the oAuth flow correctly, and I can print the web token on the browser's console.

However, I don't see much material about how to this. I want to store the token on the user's VS Code session so that he can use the app, which calls Github's API on the background.

EDIT

The other option I am contemplating is using the webview that I already have on VS Code and try to pop up Github there. Like this, which works totally fine on Google Chrome:

OAuth.popup('github').then(github => {
    console.log(github);
    // Retrieves user data from oauth provider
    console.log(github.me());
});

However, no pop up happens



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source