Skip to main content

Javascript 401 Error on Fetch (mutation)

  • September 9, 2020
  • 2 replies
  • 1931 views

Can some explain to why this plain vanilla JS returns a 401 error?

fetch(“https://api.monday.com/v2”,{
mode: ‘no-cors’,
method: ‘post’,
headers: {“Authorization”: sToken,
“Content-type”: “application/json”,
“Accept”: “application/json”,
“Access-Control-Allow-Origin”: “*”,
“Access-Control-Allow-Credentials”: “true”},
body: JSON.stringify(sQry)}
)

Both sToken and sQry are correctly assigned beforehand.

This topic has been closed for replies.

2 replies

dipro
Forum|alt.badge.img
  • Leader
  • September 9, 2020

Hey there! Thanks for posting in the community 🙂

If you’re getting a 401 error, there’s probably something wrong with your token or query. Can you please share how you’re assigning sToken and sQry so we can get to the bottom of it?

Please don’t share the actual token, but it’ll be useful to see how you’re assigning those variables.


Yoav_Amir
Forum|alt.badge.img
  • monday.com Team Member
  • September 14, 2020

Hi @enlightened, Can you elaborate more on what is the error message? we can do it in a private chat also