# Why does my Basic Auth credentials work but the Base64 version results in an error?

**URL:** <https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583>\
**Category:** Help Hub\
**Tags:** authentication\
**Created:** [May 29, 2025, 1:42pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583 "2025-05-29T13:42:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![security-observer-95](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/security-observer-95/32/32670_2.png) [@security-observer-95](https://community.postman.com/u/security-observer-95)\
**Post date:** [May 29, 2025, 1:42pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/1 "2025-05-29T13:42:30Z")

</div>

When accessing my Acuity Scheduling API, first I sent a GET request using Basic username and password. It worked. I tried the same GET request using the Base64 version of my credentials, but I get a 401 error. Why?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [May 29, 2025, 1:45pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/2 "2025-05-29T13:45:17Z")

</div>

Hey @security-observer-95 👋

Welcome to the Postman Community! :postman:

Without knowing what both of those are producing, it’s hard to tell here. Have you compared both outputs using the request details in the console to see if these are creating the same thing?

---

<div class="post-metadata">

**Author:** ![security-observer-95](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/security-observer-95/32/32670_2.png) [@security-observer-95](https://community.postman.com/u/security-observer-95)\
**Post date:** [May 29, 2025, 1:50pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/3 "2025-05-29T13:50:17Z")

</div>

I’m new to APIs, so I’m not totally sure. I used a GET request twice on the same URL, expecting to get the same result. I got a 200 with the basic auth and a 401 with the base64. Aren’t those fundamentally the same thing, just using different ciphers? Why wouldn’t both outputs be exactly the same?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [May 29, 2025, 1:54pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/4 "2025-05-29T13:54:10Z")

</div>

There are a lot of things going on here that no one can see, as these are all in front of you.

I don’t know how those 2 different methods have been applied to your requests. I know how you would have used the Auth Helper but not how you have added the base64 value.

Without more visual information, it’s just guesswork from my side. 🙏

---

<div class="post-metadata">

**Author:** ![security-observer-95](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/security-observer-95/32/32670_2.png) [@security-observer-95](https://community.postman.com/u/security-observer-95)\
**Post date:** [May 29, 2025, 2:00pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/5 "2025-05-29T14:00:44Z")

</div>

I can post screenshots: This is what it looks like using Basic Auth

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/3/f/3f51fd150a50c1e302d3f9c58f8844736112bead.png)

---

<div class="post-metadata">

**Author:** ![security-observer-95](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/security-observer-95/32/32670_2.png) [@security-observer-95](https://community.postman.com/u/security-observer-95)\
**Post date:** [May 29, 2025, 2:02pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/6 "2025-05-29T14:02:44Z")

</div>

This is what happens when I use Base64:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/0/9/094ac4152f80be861e25615f8013027045d3eb31.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [May 29, 2025, 2:09pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/7 "2025-05-29T14:09:59Z")

</div>

That’s not doing the same thing - Those are 2 different Auth Types.

The `Basic` helper would do this:

 ![Screenshot 2025-05-29 at 15.03.42](https://us1.discourse-cdn.com/getpostman/original/3X/2/2/2237f7486eb80f41efdd2c58bf929330a682606e.png)

The `API Key` helper would do this:

 ![Screenshot 2025-05-29 at 15.04.58](https://us1.discourse-cdn.com/getpostman/original/3X/3/8/383a853701bae15b54837ca45b3fb8133b3f9232.png)

This is just using the base64 value of `danny:dainton`

To get the same as the `Basic` helper, you would need to do something manual and add it like this:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/e/f/ef171e3a37ea495c442dbe59ff19c782c5af90b6.png)

Or you could also achieve this in a more programmatic way using a script.

---

<div class="post-metadata">

**Author:** ![security-observer-95](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/security-observer-95/32/32670_2.png) [@security-observer-95](https://community.postman.com/u/security-observer-95)\
**Post date:** [May 29, 2025, 2:15pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/8 "2025-05-29T14:15:10Z")

</div>

Wow, I had no idea. I thought that Basic and Base64 were just two versions of the same passcode that would lead to the same result. I had no clue they were used for different things. Thanks for explaining!

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [May 29, 2025, 2:22pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/9 "2025-05-29T14:22:52Z")

</div>

You’re welcome.

You could also use a script like this in the `pre-request` section to pull in your variables and add the header to the request:

```auto
const username = pm.environment.get('username');
const password = pm.environment.get('password');
const base64String = btoa(`${username}:${password}`);

// Add Basic Auth header to the request
pm.request.headers.add({
    key: 'Authorization',
    value: `Basic ${base64String}`
});

```

---

<div class="post-metadata">

**Author:** ![security-observer-95](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/security-observer-95/32/32670_2.png) [@security-observer-95](https://community.postman.com/u/security-observer-95)\
**Post date:** [June 2, 2025, 9:44pm UTC](https://community.postman.com/t/why-does-my-basic-auth-credentials-work-but-the-base64-version-results-in-an-error/80583/10 "2025-06-02T21:44:53Z")

</div>

Hi there! Sorry for the follow-up question but I’m new to both APIs and coding in general and I’d like to look deeper into what you’ve shared. What is the topic that I should research to learn the different Auth Types and what they are used for?
