CORS issue in Twitter OAuth API [duplicate]
CORS issue in Twitter OAuth API [duplicate]
This question already has an answer here:
I am implementing twitter signin in angular5.
To get access token from client side i am following https://developer.twitter.com/en/docs/twitter-for-websites/log-in-with-twitter/guides/implementing-sign-in-with-twitter
I am getting Cross Origin error on accessing twitter apis.
Failed to load https://api.twitter.com/oauth/request_token: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:4200’ is therefore not allowed access. The response had HTTP status code 400.
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
1 Answer
1
The guide you are following is designed for use with server-side code.
It will not work for client-side JavaScript. Twitter provides a JavaScript API but it is more limited.
You should use server-side code instead. You could use Node.JS if you want to continue to use JavaScript.