[PR #4302] [MERGED] feat: ability to refresh tokens for oauth flows #4744

Closed
opened 2026-03-17 02:15:07 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4302
Author: @amk-dev
Created: 8/27/2024
Status: Merged
Merged: 8/29/2024
Merged by: @AndrewBastin

Base: nextHead: feat/refresh-tokens-oauth


📝 Commits (3)

  • ffb7e7c feat: ability to refresh tokens
  • 2c057e3 chore: fix a check for flows supporting token refresh
  • b6a0fa5 feat: support OAuth2 Authorization type in the CLI

📊 Changes

20 files changed (+488 additions, -68 deletions)

View changed files

📝 packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts (+24 -0)
packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/multipart-form-data-coll.json (+55 -0)
packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/oauth2-auth-code-coll.json (+72 -0)
📝 packages/hoppscotch-cli/src/__tests__/functions/request/requestRunner.spec.ts (+0 -3)
📝 packages/hoppscotch-cli/src/interfaces/request.ts (+13 -4)
📝 packages/hoppscotch-cli/src/utils/getters.ts (+9 -3)
📝 packages/hoppscotch-cli/src/utils/pre-request.ts (+7 -0)
📝 packages/hoppscotch-cli/src/utils/request.ts (+4 -43)
📝 packages/hoppscotch-common/locales/en.json (+4 -0)
📝 packages/hoppscotch-common/src/components/collections/graphql/index.vue (+5 -1)
📝 packages/hoppscotch-common/src/components/collections/index.vue (+5 -1)
📝 packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue (+120 -2)
📝 packages/hoppscotch-common/src/pages/oauth.vue (+13 -0)
📝 packages/hoppscotch-common/src/services/oauth/flows/authCode.ts (+60 -1)
📝 packages/hoppscotch-common/src/services/oauth/oauth.service.ts (+9 -0)
📝 packages/hoppscotch-data/src/collection/v/3.ts (+3 -0)
📝 packages/hoppscotch-data/src/graphql/index.ts (+1 -1)
📝 packages/hoppscotch-data/src/graphql/v/6.ts (+28 -1)
📝 packages/hoppscotch-data/src/rest/index.ts (+4 -8)
📝 packages/hoppscotch-data/src/rest/v/7.ts (+52 -0)

📄 Description

Fixes HFE-548

Changes

This PR adds the ability to refresh generated oauth tokens. We only enable refresh tokens for the AuthCode flow. for other flows it doesnt make much sense to add refresh token flows as per my reading. ( but incase we get user requests, we can easily add that ).

The support for the OAuth 2 authorization type is extended to the CLI, relevant business logic to derive Authorization headers already existed but a request with the Authorization type set to oauth-2 was blocked previously reporting a status code of 501 which is changed herewith. This was also the case with the multipart/form-data content type which is enabled along with. Necessary updates are made to the test suite aimed at increasing coverage along with the relevant fixture additions.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/4302 **Author:** [@amk-dev](https://github.com/amk-dev) **Created:** 8/27/2024 **Status:** ✅ Merged **Merged:** 8/29/2024 **Merged by:** [@AndrewBastin](https://github.com/AndrewBastin) **Base:** `next` ← **Head:** `feat/refresh-tokens-oauth` --- ### 📝 Commits (3) - [`ffb7e7c`](https://github.com/hoppscotch/hoppscotch/commit/ffb7e7c9d6eb92c26d3efa3a67cdcdea55c8d846) feat: ability to refresh tokens - [`2c057e3`](https://github.com/hoppscotch/hoppscotch/commit/2c057e3f9bd1d42b64199f314d9325530d3b1486) chore: fix a check for flows supporting token refresh - [`b6a0fa5`](https://github.com/hoppscotch/hoppscotch/commit/b6a0fa5c7de46bc8ea1c8bfbc7f2df2ca45d815c) feat: support OAuth2 Authorization type in the CLI ### 📊 Changes **20 files changed** (+488 additions, -68 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-cli/src/__tests__/e2e/commands/test.spec.ts` (+24 -0) ➕ `packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/multipart-form-data-coll.json` (+55 -0) ➕ `packages/hoppscotch-cli/src/__tests__/e2e/fixtures/collections/oauth2-auth-code-coll.json` (+72 -0) 📝 `packages/hoppscotch-cli/src/__tests__/functions/request/requestRunner.spec.ts` (+0 -3) 📝 `packages/hoppscotch-cli/src/interfaces/request.ts` (+13 -4) 📝 `packages/hoppscotch-cli/src/utils/getters.ts` (+9 -3) 📝 `packages/hoppscotch-cli/src/utils/pre-request.ts` (+7 -0) 📝 `packages/hoppscotch-cli/src/utils/request.ts` (+4 -43) 📝 `packages/hoppscotch-common/locales/en.json` (+4 -0) 📝 `packages/hoppscotch-common/src/components/collections/graphql/index.vue` (+5 -1) 📝 `packages/hoppscotch-common/src/components/collections/index.vue` (+5 -1) 📝 `packages/hoppscotch-common/src/components/http/OAuth2Authorization.vue` (+120 -2) 📝 `packages/hoppscotch-common/src/pages/oauth.vue` (+13 -0) 📝 `packages/hoppscotch-common/src/services/oauth/flows/authCode.ts` (+60 -1) 📝 `packages/hoppscotch-common/src/services/oauth/oauth.service.ts` (+9 -0) 📝 `packages/hoppscotch-data/src/collection/v/3.ts` (+3 -0) 📝 `packages/hoppscotch-data/src/graphql/index.ts` (+1 -1) 📝 `packages/hoppscotch-data/src/graphql/v/6.ts` (+28 -1) 📝 `packages/hoppscotch-data/src/rest/index.ts` (+4 -8) 📝 `packages/hoppscotch-data/src/rest/v/7.ts` (+52 -0) </details> ### 📄 Description Fixes HFE-548 **Changes** This PR adds the ability to refresh generated oauth tokens. We only enable refresh tokens for the `AuthCode` flow. for other flows it doesnt make much sense to add refresh token flows as per my reading. ( but incase we get user requests, we can easily add that ). The support for the OAuth 2 authorization type is extended to the CLI, relevant business logic to derive `Authorization` headers already existed but a request with the Authorization type set to `oauth-2` was blocked previously reporting a status code of `501` which is changed herewith. This was also the case with the `multipart/form-data` content type which is enabled along with. Necessary updates are made to the test suite aimed at increasing coverage along with the relevant fixture additions. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:15:07 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#4744
No description provided.