Skip to content

Commit

Permalink
Merge pull request #143 from seegno/bugfix/authorize-user-bearer
Browse files Browse the repository at this point in the history
Fix handling of user authorize response
  • Loading branch information
nunorafaelrocha authored Dec 14, 2016
2 parents 2626bf3 + 234279f commit 6fb30eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/Uphold/UpholdClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,10 @@ public function authorizeUser($code)
array_merge($this->getDefaultHeaders(), $headers)
);

return $this->getUser($response->getContent());
$content = $response->getContent();
$bearerToken = isset($content['access_token']) ? $content['access_token'] : null;

return $this->getUser($bearerToken);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/Uphold/Tests/Unit/UpholdClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public function shouldReturnAuthorizedUserWhenResponseReturnsBearerToken()
'grant_type' => 'authorization_code',
));

$response = $this->getResponseMock('xyzzy');
$response = $this->getResponseMock(array('access_token' => 'xyzzy'));

$httpClient = $this->getHttpClientMock();

Expand Down

0 comments on commit 6fb30eb

Please sign in to comment.