diff options
author | Aaron Parecki <aaron@parecki.com> | 2018-06-10 13:09:40 -0700 |
---|---|---|
committer | Aaron Parecki <aaron@parecki.com> | 2018-06-10 13:09:40 -0700 |
commit | bb0752a72692d03b61f1719dca2a7cdc2b3052cc (patch) | |
tree | 3732b7fb712d5755d48801ed3dc84bef5796d5b5 /lib | |
parent | 510c5a52a812515de0af3fef93b7a0eb55c3fea7 (diff) |
add support for token revocation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/helpers.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/helpers.php b/lib/helpers.php index a3d289d..bfcdf63 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -223,6 +223,17 @@ function micropub_get($endpoint, $params, $access_token) { ); } +function revoke_micropub_token($access_token, $token_endpoint) { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $token_endpoint); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query([ + 'action' => 'revoke', + 'token' => $access_token, + ])); + curl_exec($ch); +} + function parse_headers($headers) { $retVal = array(); $fields = explode("\r\n", preg_replace('/\x0D\x0A[\x09\x20]+/', ' ', $headers)); |