Authlogic_oauth2 alternative for Rails 2.3 - ruby-on-rails

In order to let users signup and login using facebook I used the authlogic_oauth2 gem (v.1.1.2) along with oauth2 (v. 0.0.10) and authlogic (2.1.6) in a Rails 2.3 application.
Everything worked well for more than 2 years but from a month or so, users are not able to login or signup with Facebook anymore.
I don't know what happened but I didn't changed anything so it seems that Facebook changed something on their end and authlogic_oauth2 doesn't seem to be able to work anymore.
Which could be the easiest way to fix the issue and bring back user login/signup with facebook?
Is there any better gem to help on the job?
Thanks in advance,
Augusto

I doubt that you may have done some changes in your present application unknowingly that caused the login and logout failures.
One possible cause of the problem might be the redirections from: http://yoursite.com to http://www.yoursite.com based on the changes that you made. Check the blog that mentions this problem.
The fix is to set: config.action_controller.session[:domain] = '.YOURDOMAIN.COM' inside of environment.rb (Make sure to prefix it with the .). That will make cookies work for both www.yourdomain.com and yourdomain.com (as well as any other subdomains).
I also recommend to check the login behavior in different environments: Development and Production and then check the output in the log files clearly.
This may help you to tweak the problem domain, as you mentioned that your code was working previously.
Update:
there is an update in facebook oauth and it is mentioned that all applications need to be updated to the latest version of oauth.
So that is the possible cause for your problem.
It outlines a plan requiring all sites and apps to migrate to OAuth 2.0, process the signed_request parameter, and obtain an SSL certificate by October 1.
check the link below:
http://developers.facebook.com/blog/post/497/
Thanks!

I found the solution: Omniauth works perfectly fine with Rails 2.3 and there is even a demo app on how to integrate it with Authlogic.

A popular one would be Devise which plays well with Omniauth. I am not sure of the compatibilities with rails 2 though, maybe time to upgrade...

Any reason you can not use Koala? https://github.com/arsduo/koala

Related

Internal server error response during rails omniauth docusign callback

I am connecting to DocuSign via oauth with Rails 6 and Omniauth - it seems I have it configured correctly since visiting /auth/docusign takes me to the DocuSign login screen. After logging in, it takes me to the callback. The callback is failing because the omniauth-docusign gem is failing with the user_info hash. Where it should be getting user_info['accounts'] it is getting this:
user_info #=> {"error"=>"internal_server_error", "reference_id"=>"a0f0e8c9-2faa-4b70-90b8-875ae40f13cf"}
My API Dashboard for the App shows no log or request info. 0 total requests. Is there a log area for oauth attempts, or where to use this reference ID?
Can someone at DocuSign help with this? Your developer support page seems to say to ask here on S/O.
It appears that you didn't configure everything correctly for your Integration Key (IK which is like clientId) as well as clientSecret and the rest of the configuration that you can do for your IK.
I would suggest that you can get a pre-built Ruby application that already had this all done for you and save you some work by going to the Quickstart. This would enable you to go get a ZIP file pre-configurated with all the required gems and everything needed for auth already set based on your own developer account.
Update: if you then want to take this code into your own app, you need to also get the authentication code supplied lib/docusign.rb instead of a gem like omniauth-docusign.
As Inbar Gazit said, it's important to use the Quickstart app, which I was doing. However, not only do I already have my own existing rails app, even if I didn't, I wouldn't want to have to clean out all the extra stuff in the quickstart app that I don't need. It would be nice to have a minimal script for installing just the bare minimum into an existing rails app to get authenticated and start using the API.
In the end, the solution for me was to notice and copy the lib/docusign.rb file from the Quickstart app, instead of using an omniauth-docusign gem. The base omniauth gem had advised me to find and install that gem because there was no strategy defined for docusign. The quickstart lib file is what I needed.

Old version of recaptcha get displayed instead of the newer version using the rails gem "Recaptcha"

Thanks to the gem https://github.com/ambethia/recaptcha/ (version 0.3.6), I managed to integrate Google Recaptcha into my rails app. The problem is that only the old version (V1) is displayed, similar to below.
However, I would prefer to the newer version with the checkbox like below, which is much easier for the users. Any idea how to get there?
There is some discussion about this, see: https://github.com/ambethia/recaptcha/issues/112
You are free to implement the new API by yourself it's not that hard actually, and if you have the knowledge submit a pull request to the original repository with a working solution :-)
The instructions on how to implement reCaptcha can be found here: http://www.google.com/recaptcha/intro/index.html

Authenticating users Ionic App with Rails + Devise backend

Has anyone successfully implemented authentication on an Ionic application that uses a Rails application with Devise as a backend? If so, what implementation did you use to that end?
I have already tried solutions like cloudspace's angular-devise but it doesn't really play well with Devise on the server due to CORS (which I have already included the headers needed for it to work)
The current rails application allows facebook login, it would be nice if the Ionic app had that ability as well.
Try to give this cloudspace's angular-devise another shot
I have combined it with rack-cors
and it worked for me.
Another Implementation via Toke Auth is also working..
An example implementation of the rails part can be found here:
https://github.com/julianbei/authService
The Ionic Part can be found here:
https://github.com/julianbei/authService/tree/master/mobile
Its not beautiful but a working "quick and dirty" implementation
good luck!

Cookies not saving

I'm working on an application in localhost:3000 and I just started working with cookies and can't get them to stay saved after I quit out of chrome. I checked my preferences and they were fine, cookies from other websites like stackoverflow are being retained. I've tried multiple ways of saving the cookies including
cookies.permanent[:guest_user_id] = create_guest_user.id
and it's not working (create_guest_user is a method for implementing a guest_user, taken from https://github.com/plataformatec/devise/wiki/How-To:-Create-a-guest-user). Also, Devise isn't saving anything either when I check remember me at the login page. I even added
Devise::TRUE_VALUES << ["on"]
as was recommended by another post and that didn't work for me either. I'm using rails 3.1.1, formtastic 2.0.2, and devise 1.5.1. I'm running Mac OS 10.6.8 and chrome 15.0.874.121. Thanks for the help.
UPDATE: I even tried changing my hosts file as was recommended here Can I use localhost as the domain when setting an HTTP cookie? and it still isn't working. Am I missing something obvious?
I guess there just isn't a relatively easy way of solving this problem in chrome. I tried out a bunch of solutions from various sources with little success. Not sure why google has this design in chrome as its developer tools are great and I'm reluctant to switch browsers.

Using Windows Authentication in Ruby on Rails

I'm working on a Rails app for an internal project and can't work out how to set up the users model to use Windows Authentication for logging in. I had a look and can't find anything that was covering this topic. I've managed to configure Rails to use SQLServer fine but I'm just blanking here.
Thanks in advance.
Maybe this article helps: http://www.zorched.net/2007/06/04/active-directory-authentication-for-ruby-on-rails/

Resources