Accessing an API with Basic Auth not working

I have an issue where i get an incongruent authentication encodingā€¦

I have to use Basic Authentication in a GET API call
so I set the username to the given ā€œmyusername:89e17ea5-0b32-4dce-8b2c-8d8eb646326eā€,
and password is left blank (as this is what I am requested to do

The resulting Header Authorization value gives
Basic bXl1c2VybmFtZTo4OWUxN2VhNS0wYjMyLTRkY2UtOGIyYy04ZDhlYjY0NjMyNmU6

while an external Base64 encoding gives
bXl1c2VybmFtZTo4OWUxN2VhNS0wYjMyLTRkY2UtOGIyYy04ZDhlYjY0NjMyNmU=

A call made from outside Postman with same credentials does succeed while Postman will get
an ā€˜Invalid credentialsā€™ errorā€¦

Anybody having a hint about this? Is it because of the blank password?

Seppax

Who is requesting you to do your username and password like that?

That might be your problem.

Have you tried putting your username in the username field and password in the password field?

HI @seppax, the string ā€œmyusername:89e17ea5-0b32-4dce-8b2c-8d8eb646326eā€ contains both username and password. Generally in Basic authentication in raw format, we give header value as.

Key= Authorization
Value= Basic base64encode(username:password)

Try using the value before : as username and after : as password.
username: myusername
password: 89e17ea5-0b32-4dce-8b2c-8d8eb646326e

I hope, these are not the actual credentials.

I totally agree with @allenheltondev, the username and password request should not be like this.

In my case, same thing happened when I used environment variables as username and password and only input initial value.
Inputing current value solved it.

1 Like