Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: POST API in Perl using LWP::UserAgent with authentication providing errors

by hippo (Bishop)
on Jan 20, 2018 at 12:03 UTC ( [id://1207574]=note: print w/replies, xml ) Need Help??


in reply to POST API in Perl using LWP::UserAgent with authentication providing errors

it works when i use a java or php code

For testing only, change both the perl code and the java/php code to use a known nonce instead of a random one. Then compare the signatures you get from both perl and java/php for the same JSON request. If they differ, compare how you create them in both. Alter the perl code until they match. Then test with the API. Once that works switch the nonces back to random.

FWIW, there are enough tried and tested URL encoding functions on CPAN that I would not bother to write my own. YMMV.

  • Comment on Re: POST API in Perl using LWP::UserAgent with authentication providing errors

Replies are listed 'Best First'.
Re^2: POST API in Perl using LWP::UserAgent with authentication providing errors
by ssara (Acolyte) on Jan 20, 2018 at 12:50 UTC

    Hello, thank you for your reply. The java code uses the below nonce value:  final String nonce = String.valueOf(System.currentTimeMillis());

    In perl i am using now

    use Time::HiRes qw(gettimeofday); my $timestamp = int (gettimeofday * 1000);

    Even after this change it still fails.:(.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-26 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found