IntelliJ IDE MissingApiTokenError: `snyk` requires an authenticated account. Please run `snyk auth` and try again

2.2k Views Asked by At

I have installed the snyk vulnerability analysis plugin on my IntelliJ IDE , but when i try to run the analysis , it gives me error as below :

enter image description here

Although i understand it is asking me to provide some auth credentials for my snyk server , but i am not able to understand where to provide it in the IDE . I tried to see if i can find any options to set the snyk auth from IDE toolbar , but i could not find any . Does anyone has an idea how to solve this issue ?

2

There are 2 best solutions below

0
On BEST ANSWER

Not a very polished plug-in with regard to installation, I must say; apparently they just expect you to know that their CLI tool must be installed in order to be able to use the plug-in. No mention of that on the JetBrains Marketplace Snyk plug-in page.

But from the error message I just guessed and went ahead: Installation instructions for the CLI tool.

For example, if you have Homebrew installed, run this from the CLI:

  • brew tap snyk/tap && brew install snyk
  • snyk auth

enter image description here

I later found out that the need for their CLI tool is mentioned on their support page about the plug-in, though. But it says there ‘The plugin will automatically download the CLI in the background.’

Once the CLI tool is installed, the plugin is a joy to use:

enter image description here

0
On

Alternatively (I cannot try this myself anymore, because even after uninstalling the CLI tools, the plug-in keeps working) it might be enough to acquire an API token and enter it into the plug-in’s configuration:

  • Create a free user account at app.snyk.io
  • Navigate to app.snyk.io/account
  • Click on the form entry field within the API Token box to reveal the automatically generated token
  • Copy it to the clipboard

Screenshot from user account page at app.snyk.io

Go to IntelliJ IDEAPreferencesToolsSnyk (on macOS; for Windows it starts with FileSettings, I believe) and paste the token within the Token field.

Screenshot from IntelliJ preferences