Status 400 - Missing Client id when refreshing User token with grantType=refresh_token[on Postman it works]]

I found the error… its somehow Axios or the fact that i didnt encode as needed… dont know… it worked for two ways…

Way 1:

    function testFetch() {
      let body = new FormData();
      body.append("grant_type", "refresh_token")
      body.append("refresh_token", testlol)
      body.append("client_id", TWITCH_CLIENT_ID)
      body.append("client_secret", TWITCH_SECRET)
      fetch("https://id.twitch.tv/oauth2/token", {

        method: 'POST',
        headers: {
          //tried the Postman Header Settings
          //'Content-Type': 'application/x-www-form-urlencoded',
          Accept: "*/*",
          "Accept-Encoding": "gzip, deflate, br",
          Connection: "keep-alive"
          //'Accept': 'application/json'
        },
        body: body,
      }).then(async res => console.log(res, await res.json())).catch(async res => console.log(res, await res.json()))
        }
  1. Way:

     function test1212() {
       const details = {
         grant_type: "refresh_token",
         refresh_token: testlol,
         client_id: TWITCH_CLIENT_ID,
         client_secret: TWITCH_SECRET
    
       }
    
       let formBody  = []
    
       for (var property in details) {
         var encodedKey = encodeURIComponent(property);
         var encodedValue = encodeURIComponent(details[property]);
    
         formBody.push(encodedKey + "=" + encodedValue);
    
       }
    
       formBody = formBody.join("&");
    
       axios({
         method: 'POST',
         url: "https://id.twitch.tv/oauth2/token",
         headers: {
           //"Authorization": "OAuth " + lol,
           'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
           Accept: "*/*",
           "Accept-Encoding": "gzip, deflate, br",
           Connection: "keep-alive"
           //'Accept': 'application/json'
         },
    
         data: formBody
    
       }
    
       ).then(result => console.log(result)).catch(result => console.log(result))
    
     }
    

Post can be closed now!