Advertisement
SimpleCookie

Untitled

Dec 2nd, 2023
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const body = {
  2.     client_id: "my_id",
  3.     client_secret: "my_secret",
  4.     grant_type: "client_credentials"
  5. }
  6. fetch('https://id.twitch.tv/oauth2/token', {
  7.     method: 'post',
  8.     headers: {
  9.         'Accept': 'application/json, text/plain, */*',
  10.         'Content-Type': 'application/json'
  11.     },
  12.     body: JSON.stringify(body)
  13. })
  14. .then(function (response) {
  15.     return response.json();
  16. })
  17. .then(function (result) {
  18.     console.log(result);
  19. })
  20. .catch (function (error) {
  21.     console.log('Request failed', error);
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement