本文整理汇总了PHP中Facebook\FacebookSession::newSessionFromSignedRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP FacebookSession::newSessionFromSignedRequest方法的具体用法?PHP FacebookSession::newSessionFromSignedRequest怎么用?PHP FacebookSession::newSessionFromSignedRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook\FacebookSession
的用法示例。
在下文中一共展示了FacebookSession::newSessionFromSignedRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSession
/**
* Instantiates a FacebookSession from the signed request from input.
*
* @return FacebookSession|null
*/
public function getSession()
{
if ($this->signedRequest && $this->signedRequest->hasOAuthData()) {
return FacebookSession::newSessionFromSignedRequest($this->signedRequest);
}
return null;
}
示例2: testSessionFromSignedRequest
public function testSessionFromSignedRequest()
{
$data = array('user_id' => 4, 'oauth_token' => 'fjm', 'state' => 'wow');
$signedRequest = self::makeSignedRequest($data);
$session = FacebookSession::newSessionFromSignedRequest($signedRequest, 'wow');
$this->assertTrue($session instanceof FacebookSession);
$this->assertEquals('fjm', $session->getToken());
}
示例3: testSessionFromSignedRequest
public function testSessionFromSignedRequest()
{
$signedRequest = m::mock('Facebook\\Entities\\SignedRequest');
$signedRequest->shouldReceive('get')->with('code')->once()->andReturn(null);
$signedRequest->shouldReceive('get')->with('oauth_token')->once()->andReturn('foo_token');
$signedRequest->shouldReceive('get')->with('expires', 0)->once()->andReturn(time() + 60 * 60 * 24);
$signedRequest->shouldReceive('getUserId')->once()->andReturn('123');
$session = FacebookSession::newSessionFromSignedRequest($signedRequest);
$this->assertInstanceOf('Facebook\\FacebookSession', $session);
$this->assertEquals('foo_token', $session->getToken());
$this->assertEquals('123', $session->getUserId());
}
示例4: loginAsSignedRequest
public function loginAsSignedRequest($signed_request)
{
$this->session = FacebookSession::newSessionFromSignedRequest($signed_request);
return $this;
}