Estoy tratando de llamar a un punto final de API usando cURL y fetch (JavaScript) , ya que funciona bien con cURL donde no es igual a fetch.
Aquí está la solicitud cURL:
curl -i -L -H 'Accept: application/json' --data 'client_id=[ID]&c lient_secret=[SECRET]&grant_type=authorization_code&red irect_uri=[REDIRECT_URI]&code=[CODE]' https://orcid.org/oauth/tokenDonde buscar:
fetch("https://orcid.org/oauth/token", { method: "POST", headers: { Accept: "application/json", }, body: `client_id=[ID]&c lient_secret=[SECRET]&grant_type=authorization_code&red irect_uri=[REDIRECT_URI]&code=[CODE]`, }) .then((res) => res.json()) .then((data) => { console.log(data); }) .catch((error) => console.log(error));ERROR:
www-authenticate: Bearer realm="orcid", error="unauthorized", error_description="An Authentication object was not found in the SecurityContext"