Oauth2 for Rails and Mobile Browsers

Hi All,

Can anyone recommend a viable solution for oauth2 and ruby on rails that
handles mobile browser detection with facebook, twitter, and google?
I’ve been using omniauth and it works great with normal web browsers.
However, as soon as I try to use a mobile browser, it breaks. Part of
the issue seems to be due to which URIs are being requested and what
display type is returned, whether it be touch or wap.

Any suggestions would be appreciated.

Thanks,

Okay I did some further behavior testing on several mobile devices with
omniauth.

It appears that when I physically type the url for:

http://mysite.com/auth/facebook
http://mysite.com/auth/twitter
http://mysite.com/auth/google

Everything works fine. However, the default link_to is not working
fine.

I’ve tried:

<%= link_to image_tag(“twitter_64.png”, :size => “64x64”, :alt =>
“Twitter”), “/auth/twitter” %>

OR:

<%= link_to image_tag(“twitter_64.png”, :size => “64x64”, :alt =>
“Twitter”), “#{root_url}auth/twitter” %>

Both fail on the mobile device. What is the different between the
request states for “manual input”, and link_to?

Now I’m curious…

And, I found my answer by hacking through some of the JQ Mobile code.

The issue was related to JQ Mobile. I ended up doing:

  • <%= link_to image_tag("facebook_64.png", :size => "64x64", :alt => "Facebook"), "#{root_url}auth/facebook", :rel => "external" %>
  • <%= link_to image_tag("twitter_64.png", :size => "64x64", :alt => "Twitter"), "#{root_url}auth/twitter", :rel => "external" %>
  • <%= link_to image_tag("google_64.png", :size => "64x64", :alt => "Google"), "#{root_url}auth/google", :rel => "external" %>

Just adding a simple :rel => “external” to bypass the ajax request and
it works.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs