fetch post using multipart/form-data not working

Hello Everyone, I would like to ask for your help, I have this code setup on wix backend and everytime I run it, Im getting error_description: “OAuth 2.0 Parameter: grant_type” . Im really confused because on the body of request you can see that I have included grant_type. I would like to have your expert opinion about what is the problem.

fetch ( “siteurl/ticket-authorizer/token” , {
“method” : “post” ,
“headers” : {
“Authorization” : “Basic apikey” ,
“Content-Type” : “multipart/form-data”
},
“body” : JSON . stringify ({
“grant_type” : “client_credentials”
})
}). then ( response => response . json ())
. then ( bodyJson => console . log ( bodyJson ))
. catch ( err => console . log ( 'Error : ’ , err ));

Did you replace → “Authorization” : “Basic api-key” —> with your own API-KEY ?

I don’t know exactly which API you are reffering to, may be this one…?
https://circuit.github.io/oauth.html

May, be you will find some usefull info here.

yes, I did replace it with my actual api key. I did not include it on my post since its a sensitive data. I also tried using form data but still the same error Im getting. I tested same call in postman and its working fine.

Already tried without to STRINGIFY your data?

"body":JSON.stringify({"grant_type": "client_credentials" })

“body”:{“grant_type”: “client_credentials” }

Not sure, just a test. It’s strange that it works with postman, but not on Wix.

yes, I already tried. I also tried using formdata

Hey I am struggling with something similar. Did you eventually figure it out?