Can I just type id and password into basic auth if I want to authenticate?

Hey guys I am testing APIs with Postman. Without implementing authentication everything was working great.
I don’t have front end pages. I only test it with basic auth because this applciation will be used internally.
I only put basic auth and tried to get data.

  1. password would be hashed? or just normal characters?
  2. once I log in using basic auth when I retrieve data, do I have to login whenever I retrieve data?
    I can’t test it my authentcation is working or not using postman. If I used token, it might be easier to athetnciate but I can’t find much information about basic auth.

Basic auth is simply the username and password separated by a colon that is base64 encoded. Example:

myusername:mysecretpassword

Base64 encoded would be:
bXl1c2VybmFtZTpteXNlY3JldHBhc3N3b3Jk

To add that into your request, you could add a header with key “Authorization” and value of
Basic bXl1c2VybmFtZTpteXNlY3JldHBhc3N3b3Jk

In the past, I’ve used this website to generate basic authentication headers for me.

HOWEVER!
Postman makes it super simple to do Basic Auth. If you click on the Auth tab of your request, select “Basic Auth” from the type picker, you can then enter your credentials and it will automatically generate and insert the header for you.
image

2 Likes

Of course that is what I know of. I tried with basic auth there. But it doesn’t work. I just made php artisan make:auth and made some users through the seeder. I modified a bit and then when I tried with the basic auth, it returns 200ok but actually no data returned.

It sounds then like this issue may lie in your code rather than in Postman.

Are you able to run your endpoint locally and verify it returns what you would expect?

I am facing same problem, please help me out.
Authentication working fine in browser but not in postman.
I am using AuthenticationManagerBuilder in my spring security config

Hey @security-engineer-71,
If it’s all working on the browser, then it might be easy to get to Postman using the interceptor? https://learning.postman.com/docs/sending-requests/capturing-request-data/interceptor/
A lot of times when I can’t figure how to replicate the browser to Postman behaviour, I just use the interceptor, it’s faster that way. No or less debugging!

But where do I keep this myusername:mysecretpassword ?