fkooman\OAuth\Client\Api::deleteRefreshToken PHP Method

deleteRefreshToken() public method

public deleteRefreshToken ( Context $context )
$context Context
    public function deleteRefreshToken(Context $context)
    {
        $refreshToken = $this->getRefreshToken($context);
        if (false !== $refreshToken) {
            $this->tokenStorage->deleteRefreshToken($refreshToken);
        }
    }

Usage Example

 /**
  * Gets the user data when a user is logged in
  * @throws BearerErrorResponseException When OAuth authentication failed
  * @return array|null The user data when a user is authenticated, or null when there is no user authenticated
  */
 public function getUserData()
 {
     $accessToken = $this->getAccessToken();
     if (!$accessToken) {
         return null;
     }
     $this->httpClient->addSubscriber(new BearerAuth($accessToken->getAccessToken()));
     try {
         $response = $this->httpClient->get($this->authserverUrl . '/api/user.json')->send()->json();
         return $response;
     } catch (BearerErrorResponseException $ex) {
         $this->api->deleteAccessToken($this->context);
         $this->api->deleteRefreshToken($this->context);
         throw $ex;
     }
 }
All Usage Examples Of fkooman\OAuth\Client\Api::deleteRefreshToken