You are here

public function SalesforceCommands::revokeToken in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 5.0.x src/Commands/SalesforceCommands.php \Drupal\salesforce\Commands\SalesforceCommands::revokeToken()

Revoke the named authentication token, or the default if none specified.

@command salesforce:revoke-token @aliases sfrvk

Parameters

string $providerName: The name of the authentication provider.

Return value

string Message indicating success or failure.

Throws

\OAuth\OAuth2\Service\Exception\MissingRefreshTokenException For missing token.

File

src/Commands/SalesforceCommands.php, line 749

Class

SalesforceCommands
A Drush commandfile.

Namespace

Drupal\salesforce\Commands

Code

public function revokeToken($providerName = '') {

  // If no provider name given, use the default.
  if (empty($providerName)) {
    $providerName = $this->authMan
      ->getConfig()
      ->id();
  }
  if ($provider = SalesforceAuthConfig::load($providerName)) {
    $auth = $provider
      ->getPlugin();
    $auth
      ->revokeAccessToken();
    return "Access token revoked for {$providerName}";
  }
  return "Provider {$providerName} not found.";
}