Multiple authorisation issue

Hi there!
Is there any way to pass multiple authorization keys in API requests? Iā€™ve tried searching but couldnā€™t find any useful information at once. Maybe there were something similar but I couldnā€™t distinguish it in the lines of code :frowning_face:
So hereā€™s the issue: my endpoint has both basic and oauth at the same time. Iā€™ve tried setting them in headers

but the issue still remains.
The server responds with ā€œ401ā€ error as basic auth hasnā€™t been passed. Could anyone please advise how to solve the issue?
Thanks in advance!

Hey @Anton_IA,

Have you tried using both the Authorization tab and the Headers tab to set-up your request?
You could use the Authorization tab for OAuth as explained in the documentation (learning.getpostman.com) and the Headers tab for the Basic Auth as shown here (stackoverflow.com).

Let us know if that works!

Hi @arlem, thank you so much for your response! Yes, Iā€™ve tried that as well. The thing is when Iā€™m using both of them, the Auth headers generated by Postman automatically (temporary ones) overwrite those that I set manually in the headers so in such case, unfortunately, I can use only Oauth based on your example.


Do you happen to know any other solution?

Hey,

Looking at the screenshot you posted in the first message, were you trying coma-separated value? It seems to be the recommendation according to that StackOverflow answer.

If this doesnā€™t work, could you detail a bit more whatā€™s your use-case? That should make it easier for us to find a solution. :slight_smile:

1 Like

Thanks, @arlem! Youā€™re totally correct: Iā€™ve been using just spaces between authorizations. Setting them comma-separated solves the issue. Thank you so much for your help! :+1:

1 Like

Hey @Anton_IA, If Arlemiā€™s answer solved your query can you please mark that answer a ā€œSolutionā€ for this thread?

1 Like

It does not work for me with comma-separated. Please help!

{
ā€œfaultā€: {
ā€œfaultstringā€: ā€œInvalid Access Tokenā€,
ā€œdetailā€: {
ā€œerrorcodeā€: ā€œkeymanagement.service.invalid_access_tokenā€
}
}
}

Hi @pxzxz,
Unfortunately, itā€™s all quite server-dependent. If your application accepts multiple auth headers, itā€™ll work for you. In my case, it worked, however, when I tried the same with many other applications, it worked from time to time, not as frequently as I wanted.
If it doesnā€™t work, most likely youā€™ll need to whitelist your IP in your server configuration to bypass basic auth or to pass username&password in the request URL with the following structure: http://username:password@example.com/
What application exactly do you call? Is it a widely known one?
Hope this helps you!

Hello @Anton_IA ,
I am running the API on Postman.
I am sure that I do not need to whitelist my IP as I am able to get the response without OAuth2.