1

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.

Sumi
  • 11
  • 1
  • 2

1 Answers1

2

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.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335