Skip to content

Commit

Permalink
MSFTMPP-179: Fix token refresh for new resources
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcq committed May 20, 2015
1 parent 4635bfa commit abfe2c8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion classes/oauth2/token.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,15 @@ public static function get_for_new_resource($userid, $resource, $clientdata, $ht
'refresh_token' => $aadgraphtoken->get_refreshtoken(),
'resource' => $resource,
];
$tokenresult = $httpclient->post($clientdata->get_tokenendpoint(), $params);
$params = http_build_query($params, '', '&');
$tokenendpoint = $clientdata->get_tokenendpoint();

$header = [
'Content-Type: application/x-www-form-urlencoded',
'Content-Length: '.strlen($params)
];
$httpclient->setHeader($header);
$tokenresult = $httpclient->post($tokenendpoint, $params);
$tokenresult = @json_decode($tokenresult, true);

if (!empty($tokenresult) && isset($tokenresult['token_type']) && $tokenresult['token_type'] === 'Bearer') {
Expand Down

0 comments on commit abfe2c8

Please sign in to comment.