Authenticating users Ionic App with Rails + Devise backend - ruby-on-rails

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!

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.

Authlogic_oauth2 alternative for Rails 2.3

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

Error while implementing oauth provider using oauth-plugin(pelle)

I want to secure my web application's API using oauth. I searched a lot & finally decided to try following link http://stakeventures.com/articles/2007/11/26/how-to-turn-your-rails-site-into-an-oauth-provider.
I followed the steps & I am able to register new application successfully.
I am using devise for authentication & the pelle's oauth-plugin is compatible with acts_as_authenticated, restful_authentication or restful_openid_authentication as mentioned in the above post.
So I am getting following error when I try to run http://localhost:3000/oauth/autherize
NameError (undefined local variable or method `login_required' for #<OauthController:0xc410490>):
I searched for the solution & I got following link http://groups.google.com/group/oauth-ruby/browse_thread/thread/3656e3904050fd9a.
Now is there any alternate solution other than mentioned in above link. If yes then please guide me about that & if not then please tell me how to actually implement the solution.
Where actually the oauth_controller_spec.rb file resides? Do I need to fork & edit the plugin for that?
You may want to have a look here: authlogic and oauth-plugin. Maybe this answer is helpful.

Rails 3 / PhoneGap: Converting a Rails app into an Phonegap iOS app?

I have a site built on top of Rails. In essence, I want to release a lightweight version of it for the appstore, and I think Phonegap is a good solution w/o writing a full iOS application.
What would be the easiest way to get something like this out of the door? I'm new to PhoneGap and would love if an experience dev could shed some light on how with is done. I feel it would also be a valuable resource for many other Rails devs.
My rails 3 app uses devise for authenication, carrierwave for file processing, amazon S3 for storage, and Heroku for hosting. Can someone give me some basic insight into how all these components are wrapped up and ablwe to be used with PhoneGap?
I'm new to Phonegap too, but I'm exploring the same idea than you and I've found this useful screencast: "PhoneGap + Rails 3 API"
http://vimeo.com/18763953
The idea is that you make an HTML5 client side app that makes calls to a Rails API on the server side.
Here is the code of the screencast demo:
https://github.com/quickleft/kbomb_phonegap_server (Rails API)
https://github.com/quickleft/kbomb_phonegap_client (HTML5 client with
Phonegap).
Hope it helps!
I think it could be relevant to check my phonegap-rails gem gem and my example rails / ember.js App that is exported with Phonegap. It also implements token authentication based on ember-auth and several OAuth strategies on top of Devise.
Currently in de the devel branch: https://github.com/joscas/base_app/tree/devel
Heroku deploy: https://starter-app-staging.herokuapp.com (the desktop version)
The gem exports assets, fixes paths etc. to allow seamless export of single page apps based on a rails backend.
At 37 Signals they rendered their html SERVER SIDE and just created an app wrapper. Here's the article: https://signalvnoise.com/posts/3743-hybrid-sweet-spot-native-navigation-web-content
This is an important difference in most approaches as most will re-develop their front end using a client side framework and it has the potential to save users a bunch of time. The downside is that I've heard rumors you can't get into the iOS app store, but it doesn't seem like they had a problem with it. There's also services like GoNative.io that will wrap your app for you.
A video and code that does something similar to Javi's answer can be found at
Using Phonegap as a native container for a Rails 3 App

Ruby On Rails - Myspace app development

Which gem or plugin should I use for building Myspace applications using Ruby on Rails?
MySpace provides a REST API Ruby Library:
http://developer.myspace.com/community/libs/ruby.aspx
I don't know if it's any good.
There's also a Spacer gem. I wasn't able to get it working, however.
http://www.railslodge.com/ruby_gems/18-spacer-
Here's a snippet of code for the OAUTH gem:
http://developer.myspace.com/Community/forums/p/3626/15947.aspx
I was unable to get it working.
Another snippit of code for the OAUTH gem:
http://developer.myspace.com/Community/forums/p/804/12424.aspx
Also unable to get it working.
A large part of developing on myspace must be done through the REST api that myspace provides, as well as ajax calls to import the response. Unfortunately you're not allowed to use an iFrame until OpenSocial 0.9 which wont be out for a while. Until then become familiar with MySpace's API and ajax.
You can use the myspace-ruby-sdk http://code.google.com/p/myspaceid-ruby-sdk/
There are a sample of Rails application ( 2.2.2 version ) into

Resources