mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #2000] [feature]: Api Key based authentication #646
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#646
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mcroissant on GitHub (Dec 7, 2021).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2000
Originally assigned to: @EdwinFajardoBarrera on GitHub.
Is there an existing issue for this?
Summary
Hello,
We see many apis and api gateways using api key as a standard authentication mechanism, it would be awesome to support this authentication method in hoppscotch. This would require the ability to specificy the place where to set the api key (header or path) and under which name (different vendor and implementation use different header name).
Why should this be worked on?
Currently APIs using API Keys passed through headers have their authentication specified as any other header when they actually concern Authentication. To have a consistent handling of Authentication it should be made possible to specify API Key as an autentication method in hoppscotch
@EdwinFajardoBarrera commented on GitHub (Dec 16, 2021):
I would like to work on this issue, can you assign it to me?
@EdwinFajardoBarrera commented on GitHub (Dec 17, 2021):
Hello @liyasthomas, I have some questions about the implementation:
I've implemented the capability of adding API_KEY-based authentication, adding it in the specified header or by query params.
In the first case, I used the
effectiveFinalHeadersfunction inEffectiveURL.tsIn the second case, I'm pushing a new element to params. I tried many options but those have many issues:
Adding new param by request.param attribute
request.params.pop() request.params.push({ active: true, key, value: parseTemplateString(value, envVariables), })In this way, I need to remove the last param (empty one) and push the new one. This is the way it works better but it haves inconsistency in the Params tab: Activate/Deactivate and delete buttons don't work properly.
Adding new param by addRESTParam method in store
It doesn't set the param before the request is sent.
I really would like to read your comments of architectonical guidelines. Thanks in advance
@liyasthomas commented on GitHub (Dec 17, 2021):
Hi @EdwinFajardoBarrera, can you open a draft PR so that we can understand your code better.
We have an Authorization tab that already supports multiple types of Authorization. We could add one more type 'API KEYS' and append its key-value pair to 'effectiveFinalHeaders'. For the URL query mechanism, I guess it's up to the user to add its entry in either the 'Parameters' tab or in the URL box.
Here's the UI I expect:
The authorization headers can be generated based on the type of selected Authorization method. And yes, the API key-value pair can be added to
effectiveFinalHeadersat the time of sending the request.Let me know if you need any help.
@EdwinFajardoBarrera commented on GitHub (Dec 17, 2021):
@liyasthomas I see, this so is helpful!, I've just created a PR (#2021), I'll wait for your comments to make the changes.