OAuth2 Login for JetBrains IDE Plugins

Hi, folks!

I published a new tutorial on implementing OAuth2 login in JetBrains IDE plugins without asking users to paste personal access tokens into settings.

The example uses GitHub, but the plugin-side pattern is reusable:

  • open the provider login in the browser
  • receive the callback through the IDE
  • validate state
  • exchange the code with PKCE
  • store the token in PasswordSafe
  • use the token for API calls

If you prefer to read, there’s also a blog post :backhand_index_pointing_down:

Sample code: intellij-sdk-docs/code_samples/oauth2 at main · JetBrains/intellij-sdk-docs · GitHub

I’d be interested to hear how others handle OAuth2 in plugins, especially around multiple accounts, token refresh, and provider-specific quirks.

5 Likes

I implemented exactly like that for my AZD (azure DevOps) few weeks ago, unfortunately not all variants and external tools support oath2. For example azure DevOps server (on prem) and also Codecov, so I kept also the PAT as an option for the end user.

Also, just got a request from a user to allow authentication with azure cli so I guess I ll have to support that as well…

But the example of GitHub in the IntelliJ community was super helpful and revealing on how to support Oath2

1 Like