Exemple #1
0
 /**
  * Resolve the user access token from the signed request.
  * The access token is either provided or it can be exchanged for the code.
  *
  * @return null|Gajus\Fuss\AccessToken
  */
 public function getAccessToken()
 {
     if (!$this->access_token) {
         if (isset($this->signed_request['oauth_token'])) {
             $this->access_token = new \Gajus\Fuss\AccessToken($this->app, $this->signed_request['oauth_token'], \Gajus\Fuss\AccessToken::TYPE_USER);
         } else {
             if (isset($this->signed_request['code'])) {
                 $this->access_token = \Gajus\Fuss\AccessToken::makeFromCode($this->app, $this->signed_request['code']);
             }
         }
     }
     return $this->access_token;
 }
Exemple #2
0
 /**
  * @depends testExtendUserAccessToken
  */
 public function testExchangeLongLivedAccessTokenForCode(\Gajus\Fuss\AccessToken $access_token)
 {
     $this->assertTrue($access_token->isLong());
     return $access_token->getCode($access_token);
 }