encode client secret for graph and management api

This commit is contained in:
Colin Gagnaire 2019-07-01 14:58:57 +02:00
parent 6dc57e5aa8
commit 747bc62381
2 changed files with 4 additions and 2 deletions

View File

@ -145,10 +145,11 @@ sub get_access_token {
if ($has_cache_file == 0 || !defined($access_token) || (($expires_on - time()) < 10)) {
my $uri = URI::Encode->new({encode_reserved => 1});
my $encoded_client_secret = $uri->encode($self->{client_secret});
my $encoded_graph_endpoint = $uri->encode($self->{graph_endpoint} . '/.default');
my $post_data = 'grant_type=client_credentials' .
'&client_id=' . $self->{client_id} .
'&client_secret=' . $self->{client_secret} .
'&client_secret=' . $encoded_client_secret .
'&scope=' . $encoded_graph_endpoint;
$self->settings();

View File

@ -143,10 +143,11 @@ sub get_access_token {
if ($has_cache_file == 0 || !defined($access_token) || (($expires_on - time()) < 10)) {
my $uri = URI::Encode->new({encode_reserved => 1});
my $encoded_client_secret = $uri->encode($self->{client_secret});
my $encoded_management_endpoint = $uri->encode($self->{management_endpoint});
my $post_data = 'grant_type=client_credentials' .
'&client_id=' . $self->{client_id} .
'&client_secret=' . $self->{client_secret} .
'&client_secret=' . $encoded_client_secret .
'&resource=' . $encoded_management_endpoint;
$self->settings();