I have basic auth on the website, how can I include two authorization methods in the header, Bearer and token? Is it at all possible if so how, because if I give it like this:
This is when one overwrites the other and doesn't work.
I have basic auth on the website, how can I include two authorization methods in the header, Bearer and token? Is it at all possible if so how, because if I give it like this:
This is when one overwrites the other and doesn't work.
If you use Postman to test the API, it already supports adding authorization when calling the API Access: In the Authorization section select Bearer Token and enter your token Note: You cannot add authorization to headers
You can set multiple Authorizations using a comma
Authorization: Basic X,Bearer Y
X is the base64 encoded username:password. Basic must come before the Bearer.
If you want to set it in the parent you may consider using pre-request script:
const X = btoa('user:pass');
const Y = 'BEARER TOKEN';
pm.request.headers.add({
key: 'Authorization',
value: `Basic ${X},Bearer ${Y}`,
});