[ORCID API] POST REQUEST TO TAKE TOKEN USING FETCH JS

59 views
Skip to first unread message

Francisco Godinho Neto

unread,
Mar 10, 2021, 2:42:09 PMMar 10
to ORCID API Users
Hello, i am trying to take any acess token using the fetch library (javascript), but i don't know how to configure the header request.

My code:

imagem_2021-03-10_164046.pngThe error:
imagem_2021-03-10_164148.png

Angel Montenegro

unread,
Mar 19, 2021, 12:36:58 PMMar 19
to ORCID API Users
Hi Francisco, 

I'm Angel, tech lead at ORCID! I'm not familiar with the fetch library, however, I'm wondering why the mode is set to 'cors'? This is not a cross origin call, is a simple http request, so, I think this should work:

```
method: 'POST',
body: formBody,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
});
```

Please let me know how it goes, thanks!

Thanks
Reply all
Reply to author
Forward
0 new messages