Rob Kraft's Software Development Blog

Software Development Insights

How to POST to a REST API that requires Authentication using Fiddler

Posted by robkraft on March 8, 2013

Last October I blogged about using Fiddler to Post to a REST API. Today’s post is very similar but I go one step further and post to a REST API site that requires Basic Authentication. When making a POST to a site requiring authentication, you must include authorization information in Request Header. Sounds simple enough, until you look at an example. In Fiddler, it looks like the image below:

Fiddler Post To Site Needing Basic Authentication

The only piece of information you need to add to make Basic Authentication work is the Authorization: Basic line with the correct encoded value following it.  Despite my warning, this encoded value is easy to generate.  You just need to go to any web site that will do base64 encoding for you, plug in your logon and password using this format:

logon:password

Click the button to encode to Base64 (probably UTF8), and paste the resulting value into Fiddler.  I did this at http://www.base64encode.org as shown here:

Image of Base64Encode.org web site

Image of Base64Encode.org web site

Advertisements

2 Responses to “How to POST to a REST API that requires Authentication using Fiddler”

  1. Harv said

    Fiddler (version 4.6) includes a way to base64 encode without having to use a third party website.
    Go to Tools > Text Wizard…
    You can then enter the logon:password value and encode it. There are also many other transformations available such as URL encoding etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: