| 1 | package Document::eSign::Docusign::getTokenOnBehalfOf; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | Document::eSign::Docusign::getTokenOnBehalfOf - Retrieves an OAUTH2 token on behalf of someone else. | ||||||||||
| 10 | |||||||||||
| 11 | =head1 VERSION | ||||||||||
| 12 | |||||||||||
| 13 | Version 0.02 | ||||||||||
| 14 | |||||||||||
| 15 | =cut | ||||||||||
| 16 | |||||||||||
| 17 | =head1 functions | ||||||||||
| 18 | |||||||||||
| 19 | =head2 getTokenOnBehalfOf($varshashref) | ||||||||||
| 20 | |||||||||||
| 21 | my $response = $ds->getTokenOnBehalfOf( | ||||||||||
| 22 | { | ||||||||||
| 23 | grant_type => 'password', # only option | ||||||||||
| 24 | scope => 'api', # only option | ||||||||||
| 25 | username => 'otheruser@domain.com', | ||||||||||
| 26 | bearer => 'bearer@domain.com | ||||||||||
| 27 | } | ||||||||||
| 28 | ); | ||||||||||
| 29 | |||||||||||
| 30 | =cut | ||||||||||
| 31 | |||||||||||
| 32 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 33 | 0 | ▶ | carp("Got token request: " . Dumper(@_)) if $_[1]->debug; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | 0 | my $class = shift; | |||||||||
| 35 | 0 | my $main = shift; | |||||||||
| 36 | 0 | my $vars = shift; | |||||||||
| 37 | 0 | my $self = bless {}, $class; | |||||||||
| 38 | |||||||||||
| 39 | 0 | my $uri = '/v2/oauth2/token'; | |||||||||
| 40 | |||||||||||
| 41 | # Build the portions of the get string as needed. | ||||||||||
| 42 | |||||||||||
| 43 | 0 | my $creds = $main->buildCredentials(); | |||||||||
| 44 | |||||||||||
| 45 | 0 | my $response = $main->sendRequest('POST', 'application/json', $creds, $main->defaultUrl . $uri, $vars); | |||||||||
| 46 | |||||||||||
| 47 | 0 | return $response; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | |||||||||||
| 51 | 1 | 1; | |||||||||