GenFirst / react-twitter-auth

A React Twitter Login Component
MIT License
93 stars 52 forks source link

localhost and 127.0.0.1 confusion #25

Open joe-fenton opened 6 years ago

joe-fenton commented 6 years ago

I've been using this component and following the medium article https://medium.com/@robince885/how-to-do-twitter-authentication-with-react-and-restful-api-e525f30c62bb to get it all to work. It has been almost working for a day, and I was stuck where the pop-up window to Authorize the app would not go away and would instead reload the sign in page within the popup window. I already had the Facebook and Google sign-ins working following similar instructions, and I was working from localhost:3000 as are the examples on Medium. However, Twitter does not allow you to set a callback url that has localhost in it, so I tried 127.0.0.1:3000. This had merely resulted in the the above behavior of the sign-in screen being loaded into the pop up window. I was unaware, for quite some time trying to debug and research the problem, that I had to start the whole process from 127.0.0.1:3000, and not localhost:3000. After doing this, the sign-in worked! It wasn't so obvious to me and since the other social media buttons were working from the localhost address, I assumed that the 127.0.0.1 callback would just be interpreted the same as localhost. Is there a way that can be implemented to prevent future confusion for others?