示例#1
0
 /**
  * Issues an access token.
  *
  * @param array $scope the scope to be included in the access token
  * @param int $expires_in the time over which the access token will be valid,
  * in seconds, or {@link SimpleID\Protocols\OAuth\Token::TTL_PERPETUAL} if the token is not to expire
  * @param TokenSource $source the source, if any, from which the token is to be
  * generated
  * @param array $additional additional data to be stored on the server for this
  * token
  * @return array an array of parameters that can be included in the OAuth token
  * endpoint response
  */
 public function issueAccessToken($scope = array(), $expires_in = Token::TTL_PERPETUAL, $source = null, $additional = array())
 {
     $results = array();
     $token = AccessToken::create($this, $scope, $expires_in, $source, $additional);
     $results['access_token'] = $token->getEncoded();
     $results['token_type'] = $token->getTokenType();
     if ($expires_in != Token::TTL_PERPETUAL) {
         $results['expires_in'] = $expires_in;
     }
     return $results;
 }