arunagw / omniauth-twitter

OmniAuth strategy for Twitter
http://arunagw.github.io/omniauth-twitter/
578 stars 167 forks source link

OAuth::Unauthorized #128

Closed deepbodra97 closed 6 years ago

deepbodra97 commented 6 years ago

I am trying to implement Oauth Twitter using Devise. 1)I have created app on twitter 2)I have set callback url to: http://localhost:3000 3)I have added this to config\initializers\devise.rb config.omniauth :twitter, "key", "key secret"

Sign in with Twitter automatically appears at this route: /users/sign_up/ But on clicking it I get this error

I have ensured that the key and key secret are correct I also tried deleting and creating new app

I cannot get it fixed

Help would be greatly appreciated!

Screenshot of the error. twitter_error

kubido commented 6 years ago

try to set Callback URL Locked to 'No' in your twitter app settings

deepbodra97 commented 6 years ago

Thanks a lot! You made my day.Was stuck on this since days.

eduardopoleo commented 6 years ago

This issue seems to be happening again for at least a couple of us https://stackoverflow.com/questions/50826742/omniauth-twitter-with-rails-5-stopped-working-oauthunauthorized-403-forbidden not locking the url does not work. I have added the second callback url as recommended in the answers but no luck either.

truongnmt commented 6 years ago

For now what I've fixed is:

https://mysitecom/auth/twitter/callback
https://mysitecom
http://127.0.0.1:3000/auth/twitter/callback
http://127.0.0.1:3000/

Worked on production, still error on local, now how do I dev @@

richhollis commented 6 years ago

@truongnmt - thanks for sharing. I tried your settings for my site, but neither production or dev can "Sign in with Twitter". Existing user tokens are fine and still working OK, just can't sign in with twitter. I wonder if there is something on the Twitter side that's broken or if there is a gem issue as some people do seem to have it working.

javierfeldman commented 6 years ago

Same here, fixed it by adding https://mysite.com/auth/twitter/callback.

truongnmt commented 6 years ago

@richhollis So I finally resolved on my dev env by adding

http://localhost:3000/auth/twitter/callback

Ref: https://stackoverflow.com/a/50857912/3280050

prithvi16 commented 3 years ago

Update: May 2021 Localhost and 127.0.0.1 were not working for me. What worked for me was using http://lvh.me. It redirects requests to your local host. If your app is running on 3000 port http://lvh.me:3000 should redirect to localhost:3000

For this to work in development.rb add http://lvh.me as allowed host
config.hosts << "lvh.me" And configure your app with a callback URL like http://lvh.me:3000/your/callback/url in Twitter app settings. Now browse your website using the address http://lvh.me:3000 and try logging in with Twitter.

SalomaoMiguel commented 3 years ago

allright prithvi16. Thanks.