Пример #1
0
 public function getResponseData()
 {
     $refreshToken = $this->getRefreshToken();
     $acessToken = AccessToken::createAccessToken(['client_id' => $this->client_id, 'user_id' => $refreshToken->user_id, 'expires' => $this->accessTokenLifetime + time(), 'scope' => $refreshToken->scope]);
     $refreshToken->delete();
     $refreshToken = \conquer\oauth2\models\RefreshToken::createRefreshToken(['client_id' => $this->client_id, 'user_id' => $refreshToken->user_id, 'expires' => $this->refreshTokenLifetime + time(), 'scope' => $refreshToken->scope]);
     return ['access_token' => $acessToken->access_token, 'expires_in' => $this->accessTokenLifetime, 'token_type' => $this->tokenType, 'scope' => $refreshToken->scope, 'refresh_token' => $refreshToken->refresh_token];
 }
Пример #2
0
 public function getResponseData()
 {
     $accessToken = \conquer\oauth2\models\AccessToken::createAccessToken(['client_id' => $this->client_id, 'user_id' => \Yii::$app->user->id, 'expires' => $this->accessTokenLifetime + time(), 'scope' => $this->scope]);
     $refreshToken = \conquer\oauth2\models\RefreshToken::createRefreshToken(['client_id' => $this->client_id, 'user_id' => \Yii::$app->user->id, 'expires' => $this->refreshTokenLifetime + time(), 'scope' => $this->scope]);
     $fragment = ['access_token' => $accessToken->access_token, 'expires_in' => $this->accessTokenLifetime, 'token_type' => $this->tokenType, 'scope' => $this->scope, 'refresh_token' => $refreshToken->refresh_token];
     if (!empty($this->state)) {
         $fragment['state'] = $this->state;
     }
     return ['fragment' => $fragment];
 }
 public function getResponseData()
 {
     $authCode = $this->getAuthCode();
     $acessToken = AccessToken::createAccessToken(['client_id' => $this->client_id, 'user_id' => $authCode->user_id, 'expires' => $this->accessTokenLifetime + time(), 'scope' => $authCode->scope]);
     $refreshToken = RefreshToken::createRefreshToken(['client_id' => $this->client_id, 'user_id' => $authCode->user_id, 'expires' => $this->refreshTokenLifetime + time(), 'scope' => $authCode->scope]);
     /**
      * The client MUST NOT use the authorization code more than once.
      * @link https://tools.ietf.org/html/rfc6749#section-4.1.2
      */
     $authCode->delete();
     return ['access_token' => $acessToken->access_token, 'expires_in' => $this->accessTokenLifetime, 'token_type' => $this->tokenType, 'scope' => $this->scope, 'refresh_token' => $refreshToken->refresh_token];
 }