Skip to content

Commit

Permalink
Access exchange action expects json encoded auth code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mudi Ugbowanko committed Aug 18, 2014
1 parent 19871f5 commit 603d16a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public function refreshAction(Request $request) {
protected function getAuthCode(Request $request) {
$constraints = ['code' => [new NotBlank]];

$data = ['code' => $request->request->get('code')];
$data = @json_decode($request->getContent(), true);

$this->validate($constraints, $data);
$this->validate($constraints, $data? $data : []);

return $data['code'];
}
Expand Down
2 changes: 1 addition & 1 deletion test/Controller/AccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testExchangeAction($testCaseLabel, $expectedAuthCode, $expectedC

$client = $this->createClient(['HTTP_X_CLIENT_SECRET' => $expectedClientSecret], $this->app);
$client->followRedirects(false);
$client->request('POST', '/auth/access', $expectedAuthCode? ['code' => $expectedAuthCode] : []);
$client->request('POST', '/auth/access', [], [], [], $expectedAuthCode? json_encode(['code' => $expectedAuthCode]) : null);

$response = $client->getResponse();
$responseData = json_decode($response->getContent(), true);
Expand Down
2 changes: 1 addition & 1 deletion test/OAuth/GrantFlowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testFlow($expectToSucceed, $clientId, $redirectUri, $username, $
} else {
$client = $this->createClient([], $app);
}
$client->request('POST', '/auth/access', ['code' => $code]);
$client->request('POST', '/auth/access', [], [], [], json_encode(['code' => $code]));
$response = $client->getResponse();

if($response->getStatusCode() !== Response::HTTP_OK) {
Expand Down
2 changes: 1 addition & 1 deletion test/OAuth/RefreshFlowTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function setUp() {
$this->clientSecret = 'cl13nt53crt';
$code = explode('?code=', $redirectTargetUrl)[1];
$client = $this->createClient(['HTTP_X_CLIENT_SECRET' => $this->clientSecret], $app);
$client->request('POST', '/auth/access', ['code' => $code]);
$client->request('POST', '/auth/access', [], [], [], json_encode(['code' => $code]));
$response = $client->getResponse();

$this->credentials = json_decode($response->getContent(), true);
Expand Down

0 comments on commit 603d16a

Please sign in to comment.