Revoke all client's tokens
curl --request POST \
--url https://{tenant}/tyk/oauth/revoke_all \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'X-Tyk-Authorization: <api-key>' \
--data client_id=2a06b398c17f46908de3dffcb71ef87df \
--data client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0 \
--data org_id=6492f66e6ebbc56c6a6bf022import requests
url = "https://{tenant}/tyk/oauth/revoke_all"
payload = {
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"client_secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0",
"org_id": "6492f66e6ebbc56c6a6bf022"
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tyk-Authorization': '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
client_id: '2a06b398c17f46908de3dffcb71ef87df',
client_secret: 'MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0',
org_id: '6492f66e6ebbc56c6a6bf022'
})
};
fetch('https://{tenant}/tyk/oauth/revoke_all', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant}/tyk/oauth/revoke_all",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"X-Tyk-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/tyk/oauth/revoke_all"
payload := strings.NewReader("client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tyk-Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{tenant}/tyk/oauth/revoke_all")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/oauth/revoke_all")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022"
response = http.request(request)
puts response.read_body{
"message": "tokens revoked successfully",
"status": "ok"
}{
"message": "cannot parse form. Form malformed",
"status": "error"
}{
"message": "client_id is required",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}{
"message": "oauth client doesn't exist",
"status": "error"
}OAuth
Revoke all client's tokens
Revoke all the tokens for a given oauth client
POST
/
tyk
/
oauth
/
revoke_all
Revoke all client's tokens
curl --request POST \
--url https://{tenant}/tyk/oauth/revoke_all \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'X-Tyk-Authorization: <api-key>' \
--data client_id=2a06b398c17f46908de3dffcb71ef87df \
--data client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0 \
--data org_id=6492f66e6ebbc56c6a6bf022import requests
url = "https://{tenant}/tyk/oauth/revoke_all"
payload = {
"client_id": "2a06b398c17f46908de3dffcb71ef87df",
"client_secret": "MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0",
"org_id": "6492f66e6ebbc56c6a6bf022"
}
headers = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Tyk-Authorization': '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
client_id: '2a06b398c17f46908de3dffcb71ef87df',
client_secret: 'MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0',
org_id: '6492f66e6ebbc56c6a6bf022'
})
};
fetch('https://{tenant}/tyk/oauth/revoke_all', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenant}/tyk/oauth/revoke_all",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022",
CURLOPT_HTTPHEADER => [
"Content-Type: application/x-www-form-urlencoded",
"X-Tyk-Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{tenant}/tyk/oauth/revoke_all"
payload := strings.NewReader("client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Tyk-Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{tenant}/tyk/oauth/revoke_all")
.header("X-Tyk-Authorization", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/tyk/oauth/revoke_all")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "client_id=2a06b398c17f46908de3dffcb71ef87df&client_secret=MmQwNTI5NGQtYjU0YS00NjMyLWIwZjktNTZjY2M1ZjhjYWY0&org_id=6492f66e6ebbc56c6a6bf022"
response = http.request(request)
puts response.read_body{
"message": "tokens revoked successfully",
"status": "ok"
}{
"message": "cannot parse form. Form malformed",
"status": "error"
}{
"message": "client_id is required",
"status": "error"
}{
"message": "Attempted administrative access with invalid or missing key!",
"status": "error"
}{
"message": "oauth client doesn't exist",
"status": "error"
}Authorizations
Api key
Body
application/x-www-form-urlencoded
Was this page helpful?
⌘I