For When You Can't Have The Real Thing
[ start | index | login ]
start > perl > Authorization Basic Generation

Authorization Basic Generation

Created by dave. Last edited by dave, 83 days ago. Viewed 143 times. #1
[edit] [rdf]
labels
attachments
(2019-08-23)

Problem

How do I generate a Basic Authorization header for use in my html?

Solution

$ echo -n myuser:mypassword | base64
bXl1c2VyOm15cGFzc3dvcmQ=

Implemented as so:

my $http = HTTP::Tiny->new(
    default_headers => {
        Authorization => 'Basic bXl1c2VyOm15cGFzc3dvcmQ=',
    }
);

Commentary

There's probably some magic where I can just generate this shit automatically, but my google-fu is weak and I can't find such a thing.

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt