OmniAuth (Facebook and LinkedIn) was working for me for months.
Without any code change, I started seeing a very long delay on the callback from Facebook/LinkedIn.
It now takes about 40 seconds from:
Started GET "/auth/facebook/callback?state=e600c4acbb0e10f40....
to:
Processing by AuthenticationsController#create as HTML....
I saw an issue on that, but no resolution worked for me.
Anyone seen that? How can I solve this/figure out what's going on?
--EDIT 1--
I ran the flow with curl and found that calls to Facebook take a very long time:
time curl --data "grant_type=authorization_code&client_id=[MY CLINET ID]&client_secret=[MY CLIENT SECRET]&redirect_uri=[MY REDIRECT URI]&code=[THE CODE I GOT]" https://graph.facebook.com/oauth/access_token
>> access_token=AAAA....ZDZD&expires=5183693
real 0m20.459s
user 0m0.004s
sys 0m0.008s
time curl -H "Authorization: Bearer AAAA....ZDZD" https://graph.facebook.com/me
>> {....}
real 0m20.706s
user 0m0.012s
sys 0m0.008s
--EDIT 2--
It seems that every call with curl takes 20 seconds more than it should. I tried with Google:
time curl http://www.google.com
>> <HTML>....</HTML>
real 0m20.253s
user 0m0.012s
sys 0m0.004s
but when I try with IP:
time curl http://173.194.44.17
>> <HTML>....</HTML>
real 0m0.647s
user 0m0.012s
sys 0m0.000s
I found a hint in some website that it may have to do with slow DNS resolution. The browser on the same machine seems to work fine.
Any Ideas?
I found the solution. This was a local issue, related to slow DNS resolving in Ubuntu 12.04, which is a known issue. What solved it for me was configuring my system to work with google DNS instead of automatic configuration.