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.:(.