API Key authorization request

Hello,
I am trying to Connect Make with a web service that uses API token authorization, but I’m getting Error 401.
With the same credentials I was able to get a Token from the Postman.
Below are Print screens from Configuration and Output results.


As you are using, API Keychain when using authentication, What you want to do is in API Key parameter name, change the Header Name from X-API-Key to apikey(as per the API documentation that you are using). After which, remove the apikey header from the Headers section.

Try this and see if this works.

2 Likes

Thank you for your reply.
I made these changes but the same error appears.

Can you check the headers in the output and see what is being passed by make.

2 Likes

Headers - attached.

@Shpend_Sadiku

Can you show the request in Postman that works or the link to the documentation of the API you are trying to use in this HTTP Request using API Key Auth ?

Looking only at the print you shared, I would assume and try this way:

2 Likes

Hi,
this is the request in Postman that works.

Ok, Based on the screenshot you shared, there are a few things that you need to change in Make’s HTTP module,

  • You can use the API Key Auth request and add the APIKey in the header or you can directly pass it to headers in Make a Request Module

Screenshot from 2023-07-03 13-39-45

  • I think the way you are passing the body is not correct, so you need to use Body Type as Raw, Content Type as application/json and then pass the JSON to the request body

2 Likes

Hi,
I made these changes but I got the same error (error code 401).

Hmm, It seems weird, Maybe something is amiss, Can you share the headers section and request body that is being sent during API call?

Need to check how the header is being passed and also what the request body looks like, cause the above settings should work inline with what you have shared in screenshot.

2 Likes

the headers section and request body that is being sent during API call.
A brief explanation of what I’m trying to do. The service I want to connect “Make” to has two options: “Basic Authentication” and “JWT Bearer Token”.
If I choose basic authentication, I can connect to this service via “Make a request”, but I can’t connect via “Create API key authentication request”, nor can I connect if I choose the "JWT Bearer Token” .

this may not be the answer - but I noticed that your header from postman was Apikey (capital A) while in Make it is all lower-case (apikey). Some systems have case sensitivity in authorization related headers.

If the 3rd party service really supports “Basic Authentication” – then I would actually establish the connection via “Make a Basic Auth Request” module (you can enter username / password in the connection and it automatically takes care of everything). This is a standard authentication protocol as described here. Note: this is different from what you are trying so far because basic auth relies on a header called “Authorization”.

2 Likes

@Shpend_Sadiku Some details maybe are being ignored.

What @Darin_Patterson said about the header it could be, but besides that there’s another thing that differs between the Successful Request in Postman versus Make HTTP Request .

The print from Postman, the body ( Request Content ) is not the same as you showed in the print from Make during the API call.

The JSON ( Postman )

{
"userName": "",
"password": ""
}

is different from ( HTTP Request using Make )

{
"username": "",
"password": ""
}

3 Likes