[PR #4079] [MERGED] feat: adding support for hopp-cli in self-host Hoppscotch #4654

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

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/4079
Author: @balub
Created: 5/20/2024
Status: Merged
Merged: 5/28/2024
Merged by: @balub

Base: nextHead: feat/pat


📝 Commits (10+)

  • 6b53a82 feat: created a new table to store user PATs
  • e24b7aa chore: renamed UserTokens table name to PersonalAccessToken
  • 0b5dcda chore: added unique property to token column
  • 8c9ab5a chore: made expiresOn field optional
  • b6fe9ae chore: created access-token module
  • 089bd1f feat: created access-token rest routes
  • bd7aeec chore: created a new auth guard for PATs
  • 1a88dda chore: scaffolded routes in team collection and environments modules for CLI
  • 2bad15e chore: created method to update lastUsedOn property for accessTokens
  • 9090320 chore: created interceptor to update lastUsedOn property of PAT

📊 Changes

20 files changed (+983 additions, -24 deletions)

View changed files

📝 docker-compose.yml (+2 -2)
packages/hoppscotch-backend/prisma/migrations/20240520091033_personal_access_tokens/migration.sql (+19 -0)
📝 packages/hoppscotch-backend/prisma/schema.prisma (+31 -19)
packages/hoppscotch-backend/src/access-token/access-token.controller.ts (+107 -0)
packages/hoppscotch-backend/src/access-token/access-token.module.ts (+20 -0)
packages/hoppscotch-backend/src/access-token/access-token.service.spec.ts (+195 -0)
packages/hoppscotch-backend/src/access-token/access-token.service.ts (+203 -0)
packages/hoppscotch-backend/src/access-token/dto/create-access-token.dto.ts (+5 -0)
packages/hoppscotch-backend/src/access-token/helper.ts (+17 -0)
📝 packages/hoppscotch-backend/src/app.module.ts (+2 -0)
📝 packages/hoppscotch-backend/src/errors.ts (+36 -0)
packages/hoppscotch-backend/src/guards/rest-pat-auth.guard.ts (+48 -0)
packages/hoppscotch-backend/src/interceptors/access-token.interceptor.ts (+34 -0)
📝 packages/hoppscotch-backend/src/team-collection/helper.ts (+11 -0)
📝 packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.ts (+64 -0)
📝 packages/hoppscotch-backend/src/team-collection/team-collection.service.ts (+104 -2)
📝 packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts (+48 -0)
📝 packages/hoppscotch-backend/src/team-environments/team-environments.service.ts (+29 -0)
packages/hoppscotch-backend/src/types/AccessToken.ts (+7 -0)
📝 packages/hoppscotch-backend/src/types/RESTError.ts (+1 -1)

📄 Description

Closes HSB-441

Description

In this PR we are adding features to the Hoppscotch platform to support interaction with the Hoppscotch CLI. This PR introduces the following routes for this:

  • POST http://localhost:3170/v1/access-tokens/create - Create a Personal access token
  • DELETE http://localhost:3170/v1/access-tokens/revoke?id= - Delete a Personal access token
  • GET http://localhost:3170/v1/access-tokens/list?offset=0&limit=10 - Get a list of personal access tokens
  • GET http://localhost:3170/v1/access-tokens/collection/id - Get a team-collections for cli
  • GET http://localhost:3170/v1/access-tokens/environment/id - Get a team-environments for cli

Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

Additional Information


🔄 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/4079 **Author:** [@balub](https://github.com/balub) **Created:** 5/20/2024 **Status:** ✅ Merged **Merged:** 5/28/2024 **Merged by:** [@balub](https://github.com/balub) **Base:** `next` ← **Head:** `feat/pat` --- ### 📝 Commits (10+) - [`6b53a82`](https://github.com/hoppscotch/hoppscotch/commit/6b53a829e3f078988fb23718467e93766b082ac6) feat: created a new table to store user PATs - [`e24b7aa`](https://github.com/hoppscotch/hoppscotch/commit/e24b7aa433063f2745cf40b582d1d281c1434423) chore: renamed UserTokens table name to PersonalAccessToken - [`0b5dcda`](https://github.com/hoppscotch/hoppscotch/commit/0b5dcda1dfbff8207192bc0255e963925a47fd71) chore: added unique property to token column - [`8c9ab5a`](https://github.com/hoppscotch/hoppscotch/commit/8c9ab5a224a14b3f1b859e81bbe9a816390eace7) chore: made expiresOn field optional - [`b6fe9ae`](https://github.com/hoppscotch/hoppscotch/commit/b6fe9ae4e04ba03bc429f937a7c829b45aa236d7) chore: created access-token module - [`089bd1f`](https://github.com/hoppscotch/hoppscotch/commit/089bd1f2ab0f00e4c1587159e5c0bc2db12c6ca1) feat: created access-token rest routes - [`bd7aeec`](https://github.com/hoppscotch/hoppscotch/commit/bd7aeec7a895031ae50544dc079e061e79dcc232) chore: created a new auth guard for PATs - [`1a88dda`](https://github.com/hoppscotch/hoppscotch/commit/1a88dda535911674bdb09bb05697c444ec17f17f) chore: scaffolded routes in team collection and environments modules for CLI - [`2bad15e`](https://github.com/hoppscotch/hoppscotch/commit/2bad15ecfa43192943a937dd9210279b586a2eb7) chore: created method to update lastUsedOn property for accessTokens - [`9090320`](https://github.com/hoppscotch/hoppscotch/commit/909032030095d7b8bfbe742d38ebecd6215bcaa6) chore: created interceptor to update lastUsedOn property of PAT ### 📊 Changes **20 files changed** (+983 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `docker-compose.yml` (+2 -2) ➕ `packages/hoppscotch-backend/prisma/migrations/20240520091033_personal_access_tokens/migration.sql` (+19 -0) 📝 `packages/hoppscotch-backend/prisma/schema.prisma` (+31 -19) ➕ `packages/hoppscotch-backend/src/access-token/access-token.controller.ts` (+107 -0) ➕ `packages/hoppscotch-backend/src/access-token/access-token.module.ts` (+20 -0) ➕ `packages/hoppscotch-backend/src/access-token/access-token.service.spec.ts` (+195 -0) ➕ `packages/hoppscotch-backend/src/access-token/access-token.service.ts` (+203 -0) ➕ `packages/hoppscotch-backend/src/access-token/dto/create-access-token.dto.ts` (+5 -0) ➕ `packages/hoppscotch-backend/src/access-token/helper.ts` (+17 -0) 📝 `packages/hoppscotch-backend/src/app.module.ts` (+2 -0) 📝 `packages/hoppscotch-backend/src/errors.ts` (+36 -0) ➕ `packages/hoppscotch-backend/src/guards/rest-pat-auth.guard.ts` (+48 -0) ➕ `packages/hoppscotch-backend/src/interceptors/access-token.interceptor.ts` (+34 -0) 📝 `packages/hoppscotch-backend/src/team-collection/helper.ts` (+11 -0) 📝 `packages/hoppscotch-backend/src/team-collection/team-collection.service.spec.ts` (+64 -0) 📝 `packages/hoppscotch-backend/src/team-collection/team-collection.service.ts` (+104 -2) 📝 `packages/hoppscotch-backend/src/team-environments/team-environments.service.spec.ts` (+48 -0) 📝 `packages/hoppscotch-backend/src/team-environments/team-environments.service.ts` (+29 -0) ➕ `packages/hoppscotch-backend/src/types/AccessToken.ts` (+7 -0) 📝 `packages/hoppscotch-backend/src/types/RESTError.ts` (+1 -1) </details> ### 📄 Description <!-- Thanks for creating this pull request 🤗 Please make sure that the pull request is limited to one type (docs, feature, etc.) and keep it as small as possible. You can open multiple prs instead of opening a huge one. --> <!-- If this pull request closes an issue, please mention the issue number below --> Closes HSB-441 ### Description <!-- Add a brief description of the pull request --> In this PR we are adding features to the Hoppscotch platform to support interaction with the Hoppscotch CLI. This PR introduces the following routes for this: - POST `http://localhost:3170/v1/access-tokens/create` - Create a Personal access token - DELETE `http://localhost:3170/v1/access-tokens/revoke?id=` - Delete a Personal access token - GET `http://localhost:3170/v1/access-tokens/list?offset=0&limit=10` - Get a list of personal access tokens - GET `http://localhost:3170/v1/access-tokens/collection/id` - Get a team-collections for cli - GET `http://localhost:3170/v1/access-tokens/environment/id` - Get a team-environments for cli <!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax - [ ] Not Completed - [x] Completed --> ### Checks <!-- Make sure your pull request passes the CI checks and do check the following fields as needed - --> - [ ] My pull request adheres to the code style of this project - [ ] My code requires changes to the documentation - [ ] I have updated the documentation as required - [ ] All the tests have passed ### Additional Information <!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:10:13 +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#4654
No description provided.