Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Not sure how to use HTTP::Tiny

by huck (Prior)
on May 21, 2018 at 18:18 UTC ( [id://1214998]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Not sure how to use HTTP::Tiny
in thread Not sure how to use HTTP::Tiny

once when i was forced to do authorization myself (via tkx sockets) i used

if ($args{user} || $args{password}) { use MIME::Base64; $tkxf_auth='Authorization: Basic '.encode_base64($args{user}.':' +.$args{password},''); }
which would make your call
use MIME::Base64; my $headers = { Accept => "application/json", 'Content-Type' => "application/json", Authorization => 'Authorization: Basic '.encode_base +64($args{user}.':'.$args{password},'') };

Edit: the real userid/passwords are stored in the hash %args under keys userid and password!

Replies are listed 'Best First'.
Re^4: Not sure how to use HTTP::Tiny
by plx (Initiate) on May 21, 2018 at 19:57 UTC
    I get the same result (401) with my $headers = { Accept => "application/json", 'Content-Type' => "application/json", Authorization => "Authorization: Basic ".encode_base +64("user:password") };

      Try

      use MIME::Base64; my $headers = { Accept => "application/json", 'Content-Type' => "application/json", Authorization => "Basic ".encode_base64("user:password"), };
      poj

        i was building the whole raw line in my tkx code, and i kinda forgot what the key part would do for me in the header section, sorry

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1214998]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found