function gauth_account_revoke_token in Google Auth 7
Same name and namespace in other branches
- 7.2 gauth.module \gauth_account_revoke_token()
Unauthenticate an account.
Parameters
string $account_id: Name or id of the account to be unauthenticated
bool $by_name: Set False if passing account id and True for account name
2 calls to gauth_account_revoke_token()
- gauth_account_token_revoke_form_submit in ./
gauth.admin.inc - Submit handler to revoke access of an google auth account.
- gauth_user_services_user_account_revoke_submit in gauth_user/
gauth_user.pages.inc - Revoke access form submit handler
File
- ./
gauth.module, line 594 - Google Auth Api for drupal.
Code
function gauth_account_revoke_token($account_id, $by_name = TRUE) {
$account = gauth_account_load($account_id, $by_name);
if ($account['is_authenticated']) {
$client = gauth_client_get($account);
$client
->revokeToken();
$account['is_authenticated'] = FALSE;
$account['access_token'] = '';
drupal_write_record('gauth_accounts', $account, 'id');
return TRUE;
}
else {
drupal_set_message(t("The account is not authenticated"));
return FALSE;
}
}