I am trying to call the Twitter API in a React App and get the following error
Fetch API cannot load https://api.twitter.com/1.1/account/verify_credenti
I do not know wether or not the Twitter API allows CORS, but if it does, specifying cors mode in your request should do the trick
const response = await fetch(baseUrl, {
method: `${HTTP_GET}`,
mode: 'cors',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `OAuth ${oauthKeys[0]}="${oauthValues[0]}",${oauthKeys[1]}="${oauthValues[1]}",oauth_signature="${signature}",${oauthKeys[2]}="${oauthValues[2]}",${oauthKeys[3]}="${oauthValues[3]}",${oauthKeys[4]}="${oauthValues[4]}",${oauthKeys[5]}="${oauthValues[5]}"`,
}
});