Skip to content
This repository has been archived by the owner on Mar 29, 2019. It is now read-only.

Commit

Permalink
User can provide custom appsecret_proof
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka committed Aug 27, 2014
1 parent bff4490 commit 7eb3b5b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Kdyby/Facebook/Api/CurlClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function oauth($url, array $params)
$params['access_token'] = $this->fb->getAccessToken();
}

if (isset($params['access_token'])) {
if (isset($params['access_token']) && !isset($params['appsecret_proof'])) {
$params['appsecret_proof'] = $this->fb->config->getAppSecretProof($params['access_token']);
}

Expand Down
1 change: 0 additions & 1 deletion tests/KdybyTests/Facebook/ApiException.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ require_once __DIR__ . '/../bootstrap.php';
class ApiExceptionTest extends Tester\TestCase
{


public function testExceptionConstructorWithErrorCode()
{
$e = new FacebookApiException(array('error_code' => $code = 404));
Expand Down
27 changes: 27 additions & 0 deletions tests/KdybyTests/Facebook/Facebook.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,33 @@ class FacebookTest extends KdybyTests\FacebookTestCase



public function testAppsecretProofNoParams()
{
$facebook = $this->createWithRequest();
$apiClient = $facebook->mockApiClient();

$token = $facebook->getAccessToken();
$proof = $facebook->config->getAppSecretProof($token);

$facebook->api('/mattynoce');
Assert::same($proof, $apiClient->calls[0][1]['appsecret_proof']);
}



public function testAppsecretProofWithParams()
{
$facebook = $this->createWithRequest();
$apiClient = $facebook->mockApiClient();

$proof = 'foo';
$facebook->api('/mattynoce', array('appsecret_proof' => $proof));

Assert::same($proof, $apiClient->calls[0][1]['appsecret_proof']);
}



public function testJsonEncodeOfNonStringParams()
{
$facebook = $this->createWithRequest();
Expand Down

0 comments on commit 7eb3b5b

Please sign in to comment.