-
Notifications
You must be signed in to change notification settings - Fork 33
Should be able to authenticate using a URL query parameter #19
Comments
Thanks for creating an issue and the suggestion! Just wanted to point out that the curl example above is possible with the http-client. Get takes an url which can include query string parameters https://github.com/actions/http-client/blob/master/index.ts#L165 If used in an action (purpose of lib), the action can have an input and the consumers of it can create a secret in the repo settings, provide the value in the workflow file with ${{ ... }} giving the action access to it. The action can format it into the url. So I'm very hesitant to add the complexity of a provider layer url. Hope that helps. |
Of course, it's entirely possible for the developer to add the authentication token to the query string of the HTTP request manually. It's also entirely possible for the developer to add the authentication token to the headers, which is exactly what the existing classes in The goal in this case is developer experience. It's much more error-prone for the developer to have to remember to pass the This authentication system is clearly designed to be extensible, to accommodate this ideal of setting authentication in one place regardless of how it is applied to the HTTP request. However, I'm trying to build an Action based on |
Does the specific API in question allow auth header instead? Auth header is better to avoid being captured in logs (common for url to be captured in server logs). Request functions accept dictionary today. Easier than manipulating URL each request. Could simplify slightly in the future, if the constructor accepted a dictionary of headers to apply to each request. |
I disagree that it's the design goal to solve query string params. The design goal of the auth handlers was to be able to delay inject headers for all calls downstream. For something as explicit as creating a get request on an url where the data is part of the url, simply formatting it into the url is clearer, simpler and more straight forward without adding yet another provider layer. Strict type checking is an orthogonal issue. |
Some APIs require authentication using a query parameter in the URL. For example, the Clubhouse API has examples that look like this:
To resolve this issue,
auth.ts
should define and export a class that can handle automatically attaching a token to the query parameters in the URL. For example:The text was updated successfully, but these errors were encountered: