Skip to content

Commit

Permalink
Fix handling of user authorize response
Browse files Browse the repository at this point in the history
This fixes the handling of the user authorize response by retrieving
the access token from the array that is given by the authorize endpoint.
  • Loading branch information
joaonice committed Dec 14, 2016
1 parent 2626bf3 commit 41638da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 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
2 changes: 1 addition & 1 deletion travis.php.ini
Original file line number Diff line number Diff line change
@@ -1 +1 @@
memory_limit = 2048M
memory_limit = 4096M

0 comments on commit 41638da

Please sign in to comment.