I just spent two hours getting a “Make an API Key Auth request” HTTP module to work with no success. I added every possible combination of “My API auth key” to the keychain. But every time I ran the module, I got an “Missing Authentication header” error.
In the end I switched to a simple "Make a request HTTP module and added the API key as header items manually (not via the keychain) and that finally worked.
So I’m wondering: is there a difference between using these two modules that I’m not aware of? Or did I make some other mistake? Any feedback would be much appreciated!
And yes, I deleted the API key in the screenshots, it’s no longer working
Here’s what I did with screenshots:
So I at first I tried adding my API key to the keychain. I used every value I could think of for API Key parameter name: “Authentication”, “Bearer”, “X-API-Key”, “X-API-KEY”, the name for the API key as I chose it in the service I tried to connect to. Nothing worked.
And here’s a curl statement form the API docs of the service I tried connecting to
curl https://openrouter.ai/api/v1/chat/completions
-H “Content-Type: application/json”
-H “Authorization: Bearer $OPENROUTER_API_KEY”
-d ‘{
“model”: “openai/gpt-3.5-turbo”,
“messages”: [
{“role”: “user”, “content”: “What is the meaning of life?”}
]
}’
I think the issue is that the header isn’t called “X-API-Key” as it’s in your setup but OpenAi expects “Authorization” Header. Both headers are common ways to authenticate and some APIs even do have some weird custom headers
The difference is with the plain HTTP module, everyone who opens the module sees the API Key whereas using the API Key Module it’s safer.
Did you also use "Bearer " so speaking Bearer plus space plus your token?
Because what happens is the following: Make somewhere stores this particular information and uses it to do the API Call. They don’t know if Bearer should be there or not - same goes here. Some APIs use “Bearer”, some don’t, some put custom words in front
Yes thanks, I used “Bearer”, I used “X-API-Key” and “X-API-KEY”. I called “Pretty Please Just Work Already” As I said, i tried for two hours to get this module working.
Mhm, so if I used the API Key Module and use input everything, it looks great.
The “Headers” array is empty because they don’t want to show the API Key but it’s present in the API call and the result is good
Thanks! No it wasn’t a wrong key. I copy and pasted the same key into both modules and it didn’t work in the API Key Auth module but it did work in the simple HTTP module.
How can I specify in a API Key Auth module that a key has to be base64 encoded?
Note: the Bearer <token> goes into the Key field, and the Authorization goes into the parameter name field. Make sure the spelling is correct and that there are no leading or trailing spaces.