RAILS - Facebook login without facebook confirmation page using rails - ruby-on-rails

I'm here to discover if what I want to do is possible or not. Can I connect to facebook using a rails method without passing through the facebook confirmation page?
I want to implement an app that should have a facebook acc/pass and I need to send a comment in a timeline, but I don't want to allow the facebook page. I want to do something automatic.
Thanks!

No, the facebook api in rails is built in a way that you can't directly login to your site using facebook. This is restricted for facebook authorization issues and it's terms and conditions.
If the user wants to allow access, he’ll have to log into his account (still on the facebook page) before being redirect back to your application. In the background Facebook will return an access token that your application will use to get access to the users data.
Check this for more details.

Related

Mobile facebook login and Rails API

This is a two-fold question in that it first asks a best practice for the situation, then asks how it should be implemented.
The situation: I'm creating a mobile app which operates through an API built in Rails. Meaning, users are created and fetched through the Rails API. The mobile app will allow the user to login via Facebook.
Problem: I'm not entirely familiar with how the Facebook login functions, such as what information should be used to fetch the database user.
Question: The goal is to login via Facebook in the mobile app and it fetch the user's data (or create the user) in the database via the API. So, should I set up the Facebook login on the mobile side? Or the website (API) side? And what information should be passed to/from the API?
I'm doing the same thing for Google+, but once I understand the best method for Facebook, I'm sure it will also apply to Google+ or any other oAuth authentication.
Thanks!

MVC Facebook Login

I am working on one application which require Facebook Login.
I went through various blog and it is clear how to implement facebook or any other third party login. However just bit confused regarding login persistence/ Or process when user comes to website second time.
What i need is
User come on website and can choose wether he want to register or want to login with facebook.
Once he log in with facebbook i need some additional information from him and i will store that information along with his userid in the database.
If he log off, and comes again to website he will again provide his facebook login details.
once he do that i will get his facebook user id and with the help of that i can create a session easily.
BUT not in case he is already logged in from facebook in the browser and if he try to browse my website, then i have to redirect him to authorized page directly. In that case i have to implement a solution which will take care of this issue. While searching i found one blog which might be the way how to implement it. Facebook Login Filter
But is there any other way i can achive it?

Is it possible to call native ios Facebook login dialog from just a web page (not a web app)?

We have an ios app that uses native Facebook login just fine.
Then we also have a website (app is basically an optimized client for it) where people can login via Facebook too. When they open our website in mobile safari, they are directed to Facebook pages to authenticate there and it works, but.. it is still far from native and users have to retype credentials they often have in ios already.
So could it be possible to to somehow launch system fb authentication for just a web page (maybe using some clever URL schema?) and get granted token back to web?
Difficult way
As described here http://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified#mobile-apps you could find URL scheme to trigger the native iOS app for app authorization:
fbauth://authorize?redirect_uri=[redirect_uri]&client_id=[client_id]&response_type=token
But if you call that link it's not possible to have a redirection. You could try to hack that redirection but maybe you could not find a way out.
A secure way to solve that problem is to use a SSO token to authenticate user on your App when he logs in, and next on Safari take a redirection, with a custom url to your APP, that do as bridge to FB App via Token stored in your APP. After FB authentication you can directly redirect user back to your landing page in Safari. As said by #Lego it's an alternative way to direct authenticate that could be made by going deep to custom URL used by FB.
No, it is not yet possible to directly authenticate the user via the native Facebook App, but it's possible to authenticate the user using a custom URL scheme which opens your native iOS app which then handles the authentication flow:
The user authenticates natively with your iOS App. You then store the user login (not password) in your app (i.e. using NSUserDefaults).
Then the user opens your web page in Mobile Safari. You redirect the user via a custom url scheme to your app (i.e. using myapp://authenticate). Apple documentation on implementing custom URL schemes: click
Now, if you have an active FB session in your iOS app, you can either directly redirect the user back to your landing page in Mobile Safari, passing the access token via url get parameter or you first re-authenticate the user, displaying a login view with the user name pre-filled, which you have stored in your iOS app before (step 1) and then redirect the user to your landing page, again all depending on session state and your security needs.
For opening face book app you can use Custom URL scheme. But i am not sure if u can authenticate user from it. In case if you could also then it will be confined up to the fb account which is already configured on that device app .so better try to use face book api or something
I don't get your question exactly but i think as per your question you want to create fb app Login in safari or in your custom web view.
is this perfect ?
as per my knowledge web view is different thing and native app is different thing.
if you are Login in web view then no need to check anything token or other thing because it will give you Logout thing there.
but if you are Login in your application then "developer.facebook.com" will definitely help you.
and yes, you will do most of the thing in your app as native facebook app do.
Hope it help....

In IOS 5 how do we login to twitter from our application?

All the tutorial I found explains how to tweet and show an alert message if users cannot tweet.
What about if user hasn't logged in to twitter yet and I want to help user logged in to tweeter.
Basically we want to allow user to sign up to our services via facebook and twitter. We've taken care of facebook. Now we need to so it for twitter.
This are samples of tutorial I found
http://www.raywenderlich.com/5519/beginning-twitter-in-ios-5
I don't want to tweet. I just want to login first so I can store the users' twitter id on my database allowing it to save bookmarks, etc..
All I see is https://dev.twitter.com/docs/ios. It's not clear whether we have to compute the sig manually, do we have to open safari or what.
Did you go through api documentation on twitter integration to ios?
Here is a similar question.May be this will help you
If you want your users to login with their twitter accounts, you will have to register your application with Twitter to obtain a key to sign your requests. You can read more about this on Twitter Developer Page

Login through facebook into other sites - IPHONE

I have an application where i need to login to a website through facebook, twitter and the website's own login.
I'm not very sure how to login through facebook and connect it to the website. Like if i click on login with facebook button, it redirects to facbook login page( which is achievable with all the tutorials and information provided in the facebook developer documentation and the sdk) and then it is redirected to the website immediately after facebook login.
How to achieve this? Any suggestions or help to achieve this will well appreciated.
I also would want to know about the encrypted access token of facebook. How to use that access token. I have read the documentation, yet i have not got the concept so clear in my head.
EDIT: the website is already connected to facebook and twitter... I have to to the same on iphone.. I mean, the response i will get after login through facebook is an access token. Can i use this access token. How to link the response got after facebook login to the website to authenticate a user's login. This i need to do it in iphone.
Thanks in advance.
Here is an example on how to do it with php,
Facebook as Auth
EDIT:
As you mention you already have a website in place with facebook and twitter integration and only require to do it in iPhone.
For iPhone have a look at facebook sdk for iPhone.
What you get after a authentication from facebook in iPhone app will be a access_token. You can use this token to get the facebook userid. Match the same id with the one present in the website. This way you can validate a user.
For getting user details from acess_token try this.
graph.facebook.com/me?access_token=<token>.
This will return basic user information along with facebook userid.
Best of luck.

Resources