I am running the React project on localhost:3000. I am trying to login with Twitter using React.
URL: http://localhost:3000/login/
<TwitterLogin
loginUrl="http://localhost:4000/api/v1/auth/twitter"
onFailure={this.onFailed}
onSuccess={this.onSuccess}
requestTokenUrl="http://localhost:4000/api/v1/auth/twitter/reverse"
/>
When I clicked the Twitter login icon. I keep getting the error “TypeError: Failed to fetch”
And for the console, I am getting the following error:
OPTIONS http://localhost:4000/api/v1/auth/twitter net::ERR_CONNECTION_REFUSED
I am also confused about what should I put for the Website URL and the Callback URL for the twitter developer settings. Please help. Thanks a lot!
3
Answers
Refere their doc
Do not use localhost since you can get cors errors. See documentation for cors.
Try another package
react-twitter-login
This Implementation not used any backend and created for simple OAuth with Twitter: