コード例 #1
0
 public function testCanGetCodeFromLongLivedAccessToken()
 {
     $this->client->setCodeResponse();
     $code = $this->oauth->getCodeFromLongLivedAccessToken('long_token', 'foo_uri');
     $this->assertEquals('my_neat_code', $code);
     $expectedParams = ['access_token' => 'long_token', 'redirect_uri' => 'foo_uri', 'client_id' => '123', 'client_secret' => 'foo_secret', 'appsecret_proof' => '7e91300ea91be4166282611d4fc700b473466f3ea2981dafbf492fc096995bf1'];
     $request = $this->oauth->getLastRequest();
     $this->assertEquals($expectedParams, $request->getParams());
     $this->assertEquals('/oauth/client_code', $request->getEndpoint());
 }
コード例 #2
0
 protected function _getOAuth2ClientDebug(Facebook\Authentication\OAuth2Client $c)
 {
     $req = $c->getLastRequest();
     if (null === $req) {
         return "";
     }
     $msg = "OAuth2 Debug info:" . PHP_EOL;
     $msg .= "  URL: " . $req->getUrl() . PHP_EOL;
     $msg .= "  Method: " . $req->getMethod() . PHP_EOL;
     $msg .= "  Endpoint: " . $req->getEndpoint() . PHP_EOL;
     $msg .= PHP_EOL;
     $msg .= "  Params:" . PHP_EOL;
     $msg .= print_r($req->getParams(), true) . PHP_EOL;
     $msg .= PHP_EOL;
     $msg .= "  POST Params:" . PHP_EOL;
     $msg .= print_r($req->getPostParams(), true) . PHP_EOL;
     $msg .= PHP_EOL;
     $msg .= "  Headers:" . PHP_EOL;
     $msg .= print_r($req->getHeaders(), true) . PHP_EOL;
     $msg .= PHP_EOL;
     $msg .= "  Body:" . PHP_EOL;
     $msg .= $req->getUrlEncodedBody()->getBody() . PHP_EOL;
     $msg .= PHP_EOL;
     return $msg;
 }