apidash icon indicating copy to clipboard operation
apidash copied to clipboard

Implement OAuth 2.0 authentication

Open paulius-valiunas opened this issue 1 year ago • 7 comments

Tell us about the task you want to perform and are unable to do so because the feature is not available

I want to send requests to services that use OAuth 2.0. Right now I have to manually acquire an authorization token and copy/paste it into APIDash. The tokens expire usually in an hour, so I have to do this multiple times a day, not only separately for every service, but even for every individual request I have in the library.

Describe the solution/feature you'd like us to add

APIDash should automatically open a browser session/popup and let me sign in using OAuth 2.0's "hybrid", "implicit" flows. It should also allow me to obtain a token using the "client credentials" flow, which doesn't require a browser session (this is way easier to implement and would already be a huge step forward).

paulius-valiunas avatar Oct 14 '24 08:10 paulius-valiunas

Thanks for opening this issue @paulius-valiunas Tagged it as a good first issue so that contributors can also take a look into it and send across a PR

ashitaprasad avatar Oct 15 '24 12:10 ashitaprasad

Can you please assign this to me

beingPro007 avatar Oct 21 '24 06:10 beingPro007

@beingPro007 We do not assign any issues. Anyone can work on the issue and submit a PR.

ashitaprasad avatar Oct 21 '24 10:10 ashitaprasad

@ashitaprasad @paulius-valiunas Hi, I am Abhinav. I was working on this issue for the past 3-4 days. Currently, I have implemented the core functionalities of the OAuth2 feature. I am attaching the images of the UI and the flow. Please help me by providing iterations to make it better.

OAuth2 Feature Implementation

Current State

  1. OAuth2 Package: Utilizes the official Dart OAuth2 package.
  2. OAuth Provider: Implemented using GitHub as the OAuth provider for illustration purposes.
  3. Flow Type: Currently, only the Authorization Code flow type is implemented.

Images and Flow

Screenshot 2024-12-28 171731

Screenshot 2024-12-28 171752

Screenshot 2024-12-29 002517

Screenshot 2024-12-29 002535

Screenshot 2024-12-29 003243

Screenshot 2024-12-29 002634

abhinavs1920 avatar Dec 28 '24 19:12 abhinavs1920

@abhinavs1920 You can send across a PR for review

ashitaprasad avatar Dec 28 '24 21:12 ashitaprasad

@ashitaprasad Please check #524

abhinavs1920 avatar Jan 05 '25 08:01 abhinavs1920

Are there any plans on aligning with the OAuth 2.1 standards? It mainly simplifies OAuth 2.0 by removing the password grant and rotating refresh tokens

badnikhil avatar Apr 07 '25 22:04 badnikhil