Reputation: 31
I am working on an extension that needs to authenticate using OAuth. Is there a storage space in vscode namespace where app secret and access tokens can be stored securely? If not, any suggestions? Thanks!
Upvotes: 3
Views: 1568
Reputation: 1712
Yes, the SecretStorage utility is provided for that. Secrets are persisted across reloads and are independent of the current opened workspace.
Upvotes: 3
Reputation: 25363
If you don't want the user to see this string after you store (like in User Settings
, you should use context.globalState
.
Example Extension Tagged Comment.
This is how it stores the value:
context.globalState.update('lastTagged', str);
This is how it loads the value:
let lastTagged = context.globalState.get('lastTagged', '');
Upvotes: 0
Reputation: 2735
TL;DR. No, as of November 2017.
There are some discussions on the credential API for Visual Studio Code extensions(#15414, #31131), but as of November 2017, this feature is stalled and not planned in the near future.
As a workround, you can check globalState
and workspaceState
in vscode.ExtensionContext
as the solution to store data, but you might need to handle encryption/decryption yourself.
Upvotes: 1