We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e0e8a0 commit ce83515Copy full SHA for ce83515
inc/tokens/class-access-token.php
@@ -27,6 +27,25 @@ public function get_client() {
27
return Client::get_by_id( $this->value['client'] );
28
}
29
30
+ /**
31
+ * Revoke the token.
32
+ *
33
+ * @internal This may return other error codes in the future, as we may
34
+ * need to also revoke refresh tokens.
35
+ * @return bool|WP_Error True if succeeded, error otherwise.
36
+ */
37
+ public function revoke() {
38
+ $success = delete_user_meta( $this->get_user_id(), $this->get_meta_key() );
39
+ if ( ! $success ) {
40
+ return new WP_Error(
41
+ 'oauth2.tokens.access_token.revoke.could_not_revoke',
42
+ __( 'Could not revoke the token.', 'oauth2' )
43
+ );
44
+ }
45
+
46
+ return true;
47
48
49
/**
50
* Get a token by ID.
51
*
0 commit comments