[GH-ISSUE #1741] [feature]: Collection-wide headers and authorization #551

Closed
opened 2026-03-16 15:55:45 +03:00 by kerem · 19 comments
Owner

Originally created by @sawa-ko on GitHub (Jul 9, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1741

Is your feature request related to a problem? Please describe.
Yes, it is very annoying to be putting for example, the header of a Bearer Token in all requests and keep that header updated one by one.

Describe the solution you'd like
An option to assign to folders or collections of requests a set of global headers for the requests.

Describe alternatives you've considered
The current option is to do it one by one, something very annoying and exhausting.

Additional context
No.

Originally created by @sawa-ko on GitHub (Jul 9, 2021). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/1741 **Is your feature request related to a problem? Please describe.** Yes, it is very annoying to be putting for example, the header of a Bearer Token in all requests and keep that header updated one by one. **Describe the solution you'd like** An option to assign to folders or collections of requests a set of global headers for the requests. **Describe alternatives you've considered** The current option is to do it one by one, something very annoying and exhausting. **Additional context** No.
kerem 2026-03-16 15:55:45 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@liyasthomas commented on GitHub (Jul 10, 2021):

This is a good feature request. Will look into implementing it.

<!-- gh-comment-id:877534127 --> @liyasthomas commented on GitHub (Jul 10, 2021): This is a good feature request. Will look into implementing it.
Author
Owner

@Shylajhaa commented on GitHub (Sep 30, 2021):

@liyasthomas Is this issue available to work on?

<!-- gh-comment-id:931350995 --> @Shylajhaa commented on GitHub (Sep 30, 2021): @liyasthomas Is this issue available to work on?
Author
Owner

@liyasthomas commented on GitHub (Sep 30, 2021):

Hi @Shylajhaa, yes this issue is available for you to pick up. Thanks for showing interest in contributing to Hoppscotch, feel free to ping us if you got stuck.

<!-- gh-comment-id:931353509 --> @liyasthomas commented on GitHub (Sep 30, 2021): Hi @Shylajhaa, yes this issue is available for you to pick up. Thanks for showing interest in contributing to Hoppscotch, feel free to ping us if you got stuck.
Author
Owner

@Shylajhaa commented on GitHub (Sep 30, 2021):

Hi @Shylajhaa, yes this issue is available for you to pick up. Thanks for showing interest in contributing to Hoppscotch, feel free to ping us if you got stuck.

Thanks, @liyasthomas Can you assign it to me?

<!-- gh-comment-id:931547205 --> @Shylajhaa commented on GitHub (Sep 30, 2021): > Hi @Shylajhaa, yes this issue is available for you to pick up. Thanks for showing interest in contributing to Hoppscotch, feel free to ping us if you got stuck. Thanks, @liyasthomas Can you assign it to me?
Author
Owner

@Shylajhaa commented on GitHub (Oct 19, 2021):

Started working on this. Sharing my thoughts on design

  1. When clicking on Edit collection, another input box to get auth should be added with the options as available already (None, Basic auth, ...)
    Screenshot 2021-10-20 at 12 38 56 AM

  2. In the auth tab of a request, Inherit auth from parent option should be added.
    Screenshot 2021-10-20 at 12 41 32 AM

  3. When sending a request, the auth info from parent collection will be used

@liyasthomas Let me know if I'm missing anything here.

<!-- gh-comment-id:947029439 --> @Shylajhaa commented on GitHub (Oct 19, 2021): Started working on this. Sharing my thoughts on design 1. When clicking on Edit collection, another input box to get auth should be added with the options as available already (None, Basic auth, ...) <img width="549" alt="Screenshot 2021-10-20 at 12 38 56 AM" src="https://user-images.githubusercontent.com/22257998/137975240-2d5fe614-da7a-4cfe-bb8b-e8bf368d3ff9.png"> 2. In the auth tab of a request, Inherit auth from parent option should be added. <img width="242" alt="Screenshot 2021-10-20 at 12 41 32 AM" src="https://user-images.githubusercontent.com/22257998/137975380-7dea3196-a1b5-4c83-8755-9a187fe73780.png"> 3. When sending a request, the auth info from parent collection will be used @liyasthomas Let me know if I'm missing anything here.
Author
Owner

@sawa-ko commented on GitHub (Oct 19, 2021):

Started working on this. Sharing my thoughts on design

  1. When clicking on Edit collection, another input box to get auth should be added with the options as available already (None, Basic auth, ...)
Screenshot 2021-10-20 at 12 38 56 AM
  1. In the auth tab of a request, Inherit auth from parent option should be added.
Screenshot 2021-10-20 at 12 41 32 AM
  1. When sending a request, the auth info from parent collection will be used

@liyasthomas Let me know if I'm missing anything here.

But will that work only for the Authorization field of the Header or for everything in the Header?

<!-- gh-comment-id:947083037 --> @sawa-ko commented on GitHub (Oct 19, 2021): > Started working on this. Sharing my thoughts on design > > 1. When clicking on Edit collection, another input box to get auth should be added with the options as available already (None, Basic auth, ...) > > <img alt="Screenshot 2021-10-20 at 12 38 56 AM" width="549" src="https://user-images.githubusercontent.com/22257998/137975240-2d5fe614-da7a-4cfe-bb8b-e8bf368d3ff9.png"> > > 1. In the auth tab of a request, Inherit auth from parent option should be added. > > <img alt="Screenshot 2021-10-20 at 12 41 32 AM" width="242" src="https://user-images.githubusercontent.com/22257998/137975380-7dea3196-a1b5-4c83-8755-9a187fe73780.png"> > > 1. When sending a request, the auth info from parent collection will be used > > @liyasthomas Let me know if I'm missing anything here. But will that work only for the Authorization field of the Header or for everything in the Header?
Author
Owner

@Shylajhaa commented on GitHub (Oct 20, 2021):

Started working on this. Sharing my thoughts on design

  1. When clicking on Edit collection, another input box to get auth should be added with the options as available already (None, Basic auth, ...)
Screenshot 2021-10-20 at 12 38 56 AM
  1. In the auth tab of a request, Inherit auth from parent option should be added.
Screenshot 2021-10-20 at 12 41 32 AM
  1. When sending a request, the auth info from parent collection will be used

@liyasthomas Let me know if I'm missing anything here.

But will that work only for the Authorization field of the Header or for everything in the Header?

Only for the auth headers

<!-- gh-comment-id:947320620 --> @Shylajhaa commented on GitHub (Oct 20, 2021): > > Started working on this. Sharing my thoughts on design > > > > 1. When clicking on Edit collection, another input box to get auth should be added with the options as available already (None, Basic auth, ...) > > > > <img alt="Screenshot 2021-10-20 at 12 38 56 AM" width="549" src="https://user-images.githubusercontent.com/22257998/137975240-2d5fe614-da7a-4cfe-bb8b-e8bf368d3ff9.png"> > > > > 1. In the auth tab of a request, Inherit auth from parent option should be added. > > > > <img alt="Screenshot 2021-10-20 at 12 41 32 AM" width="242" src="https://user-images.githubusercontent.com/22257998/137975380-7dea3196-a1b5-4c83-8755-9a187fe73780.png"> > > > > 1. When sending a request, the auth info from parent collection will be used > > > > @liyasthomas Let me know if I'm missing anything here. > > But will that work only for the Authorization field of the Header or for everything in the Header? Only for the auth headers
Author
Owner

@liyasthomas commented on GitHub (Oct 20, 2021):

I guess it shouldn't only be limited to auth headers alone. Instead, to minimize the user interaction in this feature I can suggest an alternative approach. Let me know if this suits the expected output.

  1. Global Headers toggle button in "Headers section"
  2. Global Header toggle button for individual entries in "Headers section"

Turning on the global toggle button on the section set all individual headers to have an "On" state and vice-versa.
Turning an individual entry's toggle button only sets its value to the global headers array.

Global headers array is always set for every request. This way user only needs to edit in the Header section to affect all requests that are being sent.

Here's a screenshot of how the UI might look with the proposed features. Note: this same approach can be applied to parameters, body, auth, tests and many more sections — by introducing a "Global" toggle button on sections and for individual entries as well.

screely-1634705568879


Alternatively, Hoppscotch supports "Environments". The environment has "Global Environment" support. Set the volatile header value as an environment value (this can be done in any request sections: header, auth, parameters, body, etc.) and simply switch between environments to reflect the changes. Also updating the environment variable value can be done from the environments tab and the change is reflected globally.

Read more about Environments in documentation

<!-- gh-comment-id:947330081 --> @liyasthomas commented on GitHub (Oct 20, 2021): I guess it shouldn't only be limited to auth headers alone. Instead, to minimize the user interaction in this feature I can suggest an alternative approach. Let me know if this suits the expected output. 1. Global Headers toggle button in "Headers section" 2. Global Header toggle button for individual entries in "Headers section" Turning on the global toggle button on the section set all individual headers to have an "On" state and vice-versa. Turning an individual entry's toggle button only sets its value to the global headers array. Global headers array is always set for every request. This way user only needs to edit in the Header section to affect all requests that are being sent. Here's a screenshot of how the UI might look with the proposed features. Note: this same approach can be applied to parameters, body, auth, tests and many more sections — by introducing a "Global" toggle button on sections and for individual entries as well. ![screely-1634705568879](https://user-images.githubusercontent.com/10395817/138030463-b71eca25-38b5-478c-8a3d-63bd9faab512.png) --- Alternatively, Hoppscotch supports "Environments". The environment has "Global Environment" support. Set the volatile header value as an environment value (this can be done in any request sections: header, auth, parameters, body, etc.) and simply switch between environments to reflect the changes. Also updating the environment variable value can be done from the environments tab and the change is reflected globally. [Read more about Environments in documentation](https://docs.hoppscotch.io/quickstart/rest#environment-variables)
Author
Owner

@Shylajhaa commented on GitHub (Nov 27, 2021):

@liyasthomas Apologies for the delayed response. I will start looking into the design suggested by you and would like to work on this feature.

<!-- gh-comment-id:980782560 --> @Shylajhaa commented on GitHub (Nov 27, 2021): @liyasthomas Apologies for the delayed response. I will start looking into the design suggested by you and would like to work on this feature.
Author
Owner

@Shylajhaa commented on GitHub (Dec 1, 2021):

@liyasthomas @kaname-png The environment approach will solve the problem, but only seems like a workaround. That might not be an ideal situation given that there could be several API endpoints grouped under individual folders with all of these folders sharing a common environment.

The Global-Local headers solution sounds like a suitable design. Can I start working on the same?

<!-- gh-comment-id:983831721 --> @Shylajhaa commented on GitHub (Dec 1, 2021): @liyasthomas @kaname-png The environment approach will solve the problem, but only seems like a workaround. That might not be an ideal situation given that there could be several API endpoints grouped under individual folders with all of these folders sharing a common environment. The Global-Local headers solution sounds like a suitable design. Can I start working on the same?
Author
Owner

@liyasthomas commented on GitHub (Dec 1, 2021):

@AndrewBastin thoughts on this?

<!-- gh-comment-id:983833561 --> @liyasthomas commented on GitHub (Dec 1, 2021): @AndrewBastin thoughts on this?
Author
Owner

@AndrewBastin commented on GitHub (Dec 1, 2021):

I think storing metadata within collections regarding headers will work. During the Effective REST Request generation phase we just need to recursively traverse back the tree.

But this interestingly brings into the light some interesting side points we have to clear out.

  1. Cascading – How the header fields cascade. (What happens when the headers are defined in multiple levels)

  2. A UI representation – This increasingly obscures and makes it difficult to track the source of different header fields and actually the active header fields being applied onto a request and from where is a concern we have to not take lightly as this shoots up complexity on what has been a relatively easy to understand and use section of the app.

  3. Disabling – We do offer options to disable header entries from a request, how are they going to be processed ?

Except point (2), rest all seem to be self explanatory. But these are meaningful points to be considered. The current implementation works and is simple and we are not trying to be another bloated complex API Request Builder so if we can communicate clearly what is happening and this is tucked away neatly unless explicitly required, we can go ahead with this.

<!-- gh-comment-id:984141445 --> @AndrewBastin commented on GitHub (Dec 1, 2021): I think storing metadata within collections regarding headers will work. During the Effective REST Request generation phase we just need to recursively traverse back the tree. But this interestingly brings into the light some interesting side points we have to clear out. 1. Cascading – How the header fields cascade. (What happens when the headers are defined in multiple levels) 2. A UI representation – This increasingly obscures and makes it difficult to track the source of different header fields and actually the active header fields being applied onto a request and from where is a concern we have to not take lightly as this shoots up complexity on what has been a relatively easy to understand and use section of the app. 3. Disabling – We do offer options to disable header entries from a request, how are they going to be processed ? Except point (2), rest all seem to be self explanatory. But these are meaningful points to be considered. The current implementation works and is simple and we are not trying to be another bloated complex API Request Builder so if we can communicate clearly what is happening and this is tucked away neatly unless explicitly required, we can go ahead with this.
Author
Owner

@Shylajhaa commented on GitHub (Dec 3, 2021):

@liyasthomas @kaname-png Thoughts?

<!-- gh-comment-id:985675824 --> @Shylajhaa commented on GitHub (Dec 3, 2021): @liyasthomas @kaname-png Thoughts?
Author
Owner

@sawa-ko commented on GitHub (Dec 3, 2021):

@Shylajhaa I like the idea of being able to store metadata in the request folders, for example: when viewing the folder options there should also be an option called headers and depending on what headers there are, they will be applied to the other requests within the collection folder, and that there is an option in the requests that is to ignore the use of global headers for that folder.

<!-- gh-comment-id:985679290 --> @sawa-ko commented on GitHub (Dec 3, 2021): @Shylajhaa I like the idea of being able to store metadata in the request folders, for example: when viewing the folder options there should also be an option called headers and depending on what headers there are, they will be applied to the other requests within the collection folder, and that there is an option in the requests that is to ignore the use of global headers for that folder.
Author
Owner

@Tommyten commented on GitHub (Feb 14, 2022):

@Shylajhaa Any news on this? This feature would be a great addition, I'm looking forward to

<!-- gh-comment-id:1039236311 --> @Tommyten commented on GitHub (Feb 14, 2022): @Shylajhaa Any news on this? This feature would be a great addition, I'm looking forward to
Author
Owner

@AndyDonits commented on GitHub (Jul 25, 2022):

@Shylajhaa It would be great to have this feature, currently I need to edit 150 requests manually because when I imported the collection from postman it didn't take into account the authorization from the postman collection

<!-- gh-comment-id:1194525960 --> @AndyDonits commented on GitHub (Jul 25, 2022): @Shylajhaa It would be great to have this feature, currently I need to edit 150 requests manually because when I imported the collection from postman it didn't take into account the authorization from the postman collection
Author
Owner

@RenanDore commented on GitHub (Sep 29, 2022):

Hey devs, anyone have updates to this issue? Thanks!

<!-- gh-comment-id:1262627674 --> @RenanDore commented on GitHub (Sep 29, 2022): Hey devs, anyone have updates to this issue? Thanks!
Author
Owner

@nfacha commented on GitHub (Jun 26, 2023):

+1 on this, this is by far the thing I miss most from Postman

<!-- gh-comment-id:1608125463 --> @nfacha commented on GitHub (Jun 26, 2023): +1 on this, this is by far the thing I miss most from Postman
Author
Owner

@liyasthomas commented on GitHub (Dec 20, 2023):

Thanks for your patience and valuable feedback. This feature has been implemented in the latest release.

Closing this ticket as this feature is now available in the recent version. Feel free to reach out if you encounter any further concerns.

Documentation: https://docs.hoppscotch.io/documentation/features/collections#collection-properties

<!-- gh-comment-id:1863800628 --> @liyasthomas commented on GitHub (Dec 20, 2023): Thanks for your patience and valuable feedback. This feature has been implemented in the latest release. Closing this ticket as this feature is now available in the recent version. Feel free to reach out if you encounter any further concerns. Documentation: https://docs.hoppscotch.io/documentation/features/collections#collection-properties
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#551
No description provided.