1

I'm using twitter + devise + omniauth + omniauth-twitter to autheticate users via twitter api. From my site I reach, twitter login. I give my twitter credentials. After that I'm redirected to callback url. But the response says the authetication failed. Is there a way I can identify the reason for authetication failure.

If the authetication is successful, I'll have the information in request.env['omniauth.auth'] . What about when the authetication fails? Is there any similar variable available?

robert
  • 8,459
  • 9
  • 45
  • 70

2 Answers2

2

Yes, you can use request.env['omniauth.error'].

Erik
  • 21
  • 3
0

Omniauth redirects to "/auth/failure" when the authentication fails and it passes a message parameter with the error. So if you catch that in your routes.rb, then you can log params[:message] in the corresponding controller action to figure out what happened.

aruanoc
  • 817
  • 1
  • 7
  • 9