a woman writing on paper holding by the man in black jacket

Generate Basic Authorization headers with Postman

If you’ve ever written code that contains HTTP requests, you might’ve run into this one. You’re using Basic authentication, which is easy enough. You have the username and the password for the app. But what are you supposed to do with them?!

You are supposed to send them using the “Authorization” header, as a base64 encoded version of the username and password. There are plenty of tutorials out there to explain how to do just that. However, if you are already using Postman there’s a faster way to generate this header. By – you guessed it already – using Postman.

Here’s the hack we use to generate the Authorization header.

Start by creating a new Http Request in a workspace, by clicking the + button and selecting “HTTP”

You can ignore the URL field. Click the “Authorization” tab, and select “Basic Authentication from the dropdown options.

On your right hand side, you’ll see the “username” and “password” field. Enter both in their respective fields.

Once that is done, click on the “Headers” tab. You’ll usually need to click “show hidden” to reveal all headers, including the Authorization header. Once that’s done, you can copy the value from the “Authorization” key and use it in your code. Once you’re done, you can close Postman.

Leave a Reply

Discover more from PowerUser Guide

Subscribe now to keep reading and get access to the full archive.

Continue reading