JetClient / jet-client-support

JetClient is an advanced REST API Client plugin for JetBrains IDEs
https://plugins.jetbrains.com/plugin/21173-jetclient
111 stars 0 forks source link

OAuth 2 - Implicit Flow, Access Token not loaded #34

Closed janzen01 closed 1 year ago

janzen01 commented 1 year ago

Describe the bug I configured OAuth 2 Implicit Grant flow via Microsoft Entra. The Access Token call was successful, and Entra issued an Access Token, but this token was not loaded to the plugin config.

image image

Steps to reproduce

  1. Set OAuth 2 as the Auth type
  2. Choose Implicit as Grant Type
  3. On Microsoft Entra (formerly Azure Active Directory), register an application to be able to obtain a Client ID and configure Redirect URIs --> Web
  4. In plugin OAuth 2 Options set:
  5. Hit the "GET NEW ACCESS TOKEN" button

Expected behavior After hitting the button, Call Auth Service and automatically import obtained token to the plugin configuration.

Environment information:

AntonShuvaev commented 1 year ago

Thanks for reporting the issue. I will look into it.

AntonShuvaev commented 1 year ago

The behavior you're observing is actually expected due to the nature of OAuth 2.0's Implicit Grant flow. In the "Implicit" grant flow, the access token is sent as a URL fragment (#access_token=token). According to HTTP specifications, the fragment part of the URL is never sent to the server; it's designed to be processed client-side.

This means that when you authorize using an external browser, the browser itself will not forward this fragment back to the plugin, thus it can't be automatically imported.

There are two ways to work around this:

janzen01 commented 1 year ago

Thank you for your investigation. I will look into it. :)