Advertisement
dragosgaf

devforum-4381

Mar 5th, 2019
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.89 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <script type="text/javascript">
  5. var baseUrl = 'https://org.okta.com';
  6. var requestPath = '/oauth2/v1/revoke';
  7. var xhr = new XMLHttpRequest();
  8. if ("withCredentials" in xhr) {
  9.     xhr.onerror = function() {
  10.       alert('Invalid URL or Cross-Origin Request Blocked.  You must explicitly add this site (' + window.location.origin + ') to the list of allowed websites in the administrator UI');
  11.     }
  12.     xhr.onload = function() {
  13.         alert(this.responseText);
  14.     };
  15.     xhr.open('POST', baseUrl + requestPath, true);
  16.     xhr.setRequestHeader("Accept", "application/json");
  17.     xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  18.     xhr.withCredentials = true;
  19.     xhr.send("client_id=CLIENT_ID_HERE&token_type_hint=access_token&token=ACCESS_TOKEN_HERE");
  20. } else {
  21.     alert("CORS is not supported for this browser!")
  22. }
  23. </script>
  24. </body>
  25. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement