# Accessing an API with Basic Auth not working

**URL:** <https://community.postman.com/t/accessing-an-api-with-basic-auth-not-working/20699>\
**Category:** Help Hub\
**Created:** [February 23, 2021, 11:30am UTC](https://community.postman.com/t/accessing-an-api-with-basic-auth-not-working/20699 "2021-02-23T11:30:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seppax](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@seppax](https://community.postman.com/u/seppax)\
**Post date:** [February 23, 2021, 11:30am UTC](https://community.postman.com/t/accessing-an-api-with-basic-auth-not-working/20699/1 "2021-02-23T11:30:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [February 23, 2021, 12:24pm UTC](https://community.postman.com/t/accessing-an-api-with-basic-auth-not-working/20699/2 "2021-02-23T12:24:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [February 23, 2021, 1:55pm UTC](https://community.postman.com/t/accessing-an-api-with-basic-auth-not-working/20699/3 "2021-02-23T13:55:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![syunyama](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@syunyama](https://community.postman.com/u/syunyama)\
**Post date:** [October 27, 2022, 5:48am UTC](https://community.postman.com/t/accessing-an-api-with-basic-auth-not-working/20699/4 "2022-10-27T05:48:26Z")

</div>

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.
