Visual Studio Code extension authentication
To scan your Projects you must authenticate with Snyk.
Before authenticating ensure you configure your Snyk region properly if you use Snyk on the EU and AU tenants. For more information, see Regional hosting and data residency.
Snyk supports the following protocols for authentication:
OAuth 2.0 (default)
Snyk API token (fallback option)
For both methods, Snyk uses the Secret Storage API to store the token securely. This storage uses the system's keychain to manage the token.
Steps to authenticate using the OAuth 2.0 protocol
To authenticate follow these steps:
After the extension is installed, click the Snyk Icon in the navigation bar, and then click Connect & Trust Workspace:
The extension opens a new page in a default browser and asks you to log in to your Snyk account:
The next page asks for your authorization for the IDE to act on your behalf. Click Grant app access.
After you authenticate successfully, view the confirmation message.
The IDE reads and saves the authentication on your local machine. Close the browser window and return to the IDE.
The analysis starts automatically. If you have problems, see OAuth 2.0 authentication does not work.
OAuth 2.0 tokens are not static and cannot be copied from Snyk account page.
Steps to authenticate using your Snyk API token
This method is inferior to the OAuth method.
To authenticate follow these steps:
After the extension is installed, click the Snyk Icon in the navigation bar; then click the Settings icon, find Authentication Method, and change it to Token authentication:
Copy your API token. For details, see How to obtain your Snyk API token.
Then run the
Snyk: Set Token command
and paste the token in the text field.
How to switch accounts
To re-authenticate with a different account, follow these steps:
Run the provided
Snyk: Log Out
command.
When you have logged out, start authentication from scratch.
Requirements for Linux and Unix
When authenticating with Snyk, users have the option to copy the authentication URL to their clipboard.
For Linux and Unix users, this requires that the xclip
or xsel
utility be installed.
Last updated