And I now get the following output.#!/usr/bin/perl -w use strict; use warnings; use LWP::UserAgent; my $netloc = "xxx.xx.xx.xx"; my $realm = "Realm"; my $user = "usercode"; my $pass = "passcode"; my $ua = LWP::UserAgent->new(); $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}=0; $ua->default_header( "Authorization" => "Basic bGJLN0dLaGNmVTM2MkxNbjp +zOUtKRXR0UVBHeGIyTkxkcEpMM3hHbmlLN0MwaUk="); $ua->default_header( "Accept" => "*/*" ); $ua->default_header( "Content-Type" => "application/x-www-form-urlenco +ded"); $ua->credentials( $netloc, $realm, $user, $pass); $ua->ssl_opts( verify_hostname => 0, SSL_verify_mode => 0x00); my $url = "https://".$netloc."/api/v2/access/token"; my $resp = $ua->post($url, Content => ['grant_type' => "client_creden +tials"]); if ($resp->is_success) { my $output = $resp->decoded_content; print $output."\n"; } else { print $resp->as_string(); }
Thank you for taking time and steering me in the right direction. That postman console really helped me a lot. Thank you very much.{"access_token":"ea1dda77710f64b0db328415427a1463e74ea204","expires_in +":3600,"token_type":"bearer"}
In reply to Re^3: Getting an Access Token
by PerlMonger79
in thread Solved: Getting an Access Token
by PerlMonger79
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |