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.

Popular posts from this blog

How to make file upload 'Required' in Contact Form 7?

Rothschild family

amazon EC2 - How to make wp-config.php to writable?