How to Use Omniauth after the Authentication? - ruby-on-rails

Im developing and application that will need constant updates from users that will be gathered from their social networks (twitter, facebook, linkedin and g+), but omniauth just allows me to get this data on the authentication.
I need to get them after (with a delayed_job). I could manage to do so on facebook using Koala, but I don't really know how to do it for the other networks...
What I need to activate omniauth outside the authentication process?

You should use OmniAuth to authenticate user. Also you now have their token. Just use it to make API calls required for your task. Don't forget to have all privileges needed.

Related

Integrating Facebook and Google Login to an existing REST API in Ruby on Rails

I have a Rest API written in Ruby on Rails which is having a regular SignUp and SignIn via a username and password. The SignUp and SignIn flows are currently handled through "devise" and "simple_token_authentication" Ruby Gems.
Now I need to integrate Facebook and Google Login to the existing SignUp and SignIn flows. Therefore, I'm looking for a recommendation to implement this easily.
I have already done some research and found, that I could use Koala for Facebook integration and I personally feel like Koala is a heavy Gem only to handle Facebook Login.
Would you recommend using it or does anyone else have an alternative approach. Or even writing a custom code to validate the Facebook access token in the server end sending back the application specific authentication token back to the client would be better.
PS : Is there a possibility of using the Omniauthable module in Devise to authenticate Facebook and Google users via the REST API.

OAuth 2.0 + Omniauth with SAP SuccessFactors

I want to implement an OAuth with SuccessFactors solution for my web application but I am having a hard time figuring out the best way to implement this, or if there is an existing workflow to do this.
I have a Ruby on Rails app that already uses Omniauth to authenticate with other services (Facebook, Twitter, Office 365, etc) so I thought this would be easy.
I just want my users to be able to sign-in using SuccessFactors and to pull basic information from it (name, email, status, etc). I am very unfamiliar with SuccessFactors' method of authentication as detailed here. It seems to use both SAML 2.0 and OAuth 2.0.
Does anyone have any experience with this or with similar authentication flows? Will I be able to make this work with Omniauth?

Unlink omniauth provider

I'm building a simple authentication system that will allow multiple providers for a single user. I'm using omniauth and devise. Is there a way to unlink a particular provider for a single user from my application?
By unlinking provider I mean removing the user from oauth application and removing data (uid and things like that) about this particular provider (Facebook, Twitter) from my database. That is, the user will not be able to sign in using Facebook, for example, anymore after unlinking.
I've already checked this and it does not helper too much. I've also checked out devise and omniauth docs. It seems that there's no built in way of achieving this. Do I have to make requests by myself to each provider in order to unlink an OAuth token?
No, OmniAuth and Devise do not have this "feature" built-in. You would have to implement it as a separate controller, that would manage user providers.

Rails - Using twitter oAuth for logging in users

I use Twitter oAuth to allow users to signup for my site.
I have the user's access_token, access_secret from their signup stored.
When the user wants to return to the site and login to their account, how do I authenticate them using twitter login/password?
I do not want to ask users to give access like:
- give access to example.com to read/write your stuff on twitter
The user already has signed up using their twitter credentials, how do I reuse it instead of asking them to create a separate password?
I would rather not venture towards authlogic in addition to oauth
Currently, if the user is already logged into twitter, I can authenticate him.
using the access_token, access_secret. What if he is not logged in?
How do I prompt for username/password for twitter and authenticate for my app?
Thanks for your help.
Try using them OmniAuth gem. Makes doing that pretty straight forward.
If you're not wanting another gem dependency, you could probably code up your own functionality based on what they do with their twitter strategy and abstract oauth logic.
This RailsCasts episode demonstrates how to create a simple authentication system that only requires an OAuth verification, without the need for a seperate user account maintained by your app.

How to use oauth from a facebook app

I'm developing a facebook app with rails that uses external apis from my own domain. The problem is that my domain requires authentication, which is done via oauth. It's not clear to me how to deal with this pattern. I'm not sure I can make oauth calls from a facebook app, thus requiring two separate registrations. Is there a way to pass a facebook access token so that I know the user is authenticated through facebook?
If you are using (or can use) Rails 3.0+, devise has a good section on how to authenticate via facebook or a google account.
Once a user has used this method to authenticate to your webapp, their session is handled in the same way a regular login session is, so you can just use current_user.nil? or user_signed_in? helpers to determine if the users are authenticated or not.

Resources