share content on facebook from web service - facebook

I have a REST web service written in PHP that is part of a web site. This web site has users that can post data where have they traveled and rate the place. Mobile app. uses the web service to submit the travel details.
Can a user share his "travel data" on Facebook trough web service?
Goal, Use Case:
User on his phone selects a country, city .... rate it and submit the data, data is sent to web service that writes this data to DB and shared it on Facebook as the user of the web site that has FB membership).
Assumptions:
User should loggin trough the site and request a "permanent" token from Facebook, store it in DB.user_settings, use the token when data is sent from mobile app.
Update: Or, collect users FB username/pass in DB.user_settings and authenticate when web service method for posting data on FB is called.
Problem:
Token is not "permanent"
How to authenticate the user, and not send any credentials from the mobile app. concerning Facebook, but keep all the FB logic in web service?
(im interested in concept design/algorithm, not code)

Related

Will an api provider know if the request coming from facebook app or the website?

I have a website (lets say a game) and a facebook app (a game on facebook) for it. The website uses a third party api to pull some data based on user input. Will this api provider know if the request is coming from the facebook app or from the website?

Login flow from mobile app on web server with Facebook Oauth

I have a web application built with Spring and spring security that allows user to register ether via Facebbok or creating an account, in both cases an web app account is created. So the 2 registering methods are the following::
Registering directly on the web app: the username and password are stored in the db.
Registering via facebook: the user logins into facebook (Outh), the web app retrieve the data from facebook to fill the registration form. The web app prompt the user to create the webapp account. In my database I store web app user and facebook data (access token etc..), so that the second time I try to login I can match the facebook account with the web app account (I use spring social).
Now I'm creating a rest service for the mobile app and it requires authentication. I use the basic http auth to access the web services.
My question now is how to Log in a user in my web application using spring security?
What I thought was:
Mobile app logs into facebook and retrieve the access_token (no contact with the web application server yet)
Mobile app sends access token to the web app
Web app checks if the access token is valid ether with db or directly with facebook
In case is valid the access token, the app sends back to the mobile app the username and the password (could be encrypted with a private key algorithm)
Once receive the web app user and password the user is authenticated and this information are stored on the mobile and used for http auth.
Do you think this flow is secure? do you have other ideas?
Thank you in advance

Login from Facebook app using Facebook JS then talk to an HTTPS web-service with unique user id?

Can anyone tell me what I can extract from the Facebook JS SDK that I can use to send to a web service that I'm using to safely identify a user from?
For example, once I have established the user has auth'd my application, I want to register this user in my server database. Then I want to use their ID to request data about this user, so a GET to my server such as "user//thedata".
Here is what I'm trying to achieve. Once my user is logged in using the Facebook API, I want to able to make web service calls to my hosted web service in the context of that user only. How do I avoid traffic sniffing or simply asking the web service for a different users ID for their data?
Update:
Do I simply use the auth_token that Facebook gives me after logging in, send this to my server, and then have the server query the Facebook Graph API with the token to get the user ID?
Thanks.

Authentication with Facebook on mobile and Django

I am developing a Facebook application for mobile platforms. The mobile part is being developed with PhoneGap and the server side is Python / Django.
The mobile app should be able to query Facebook API directly. Server should be able to query Facebook API on the users' behalf too. Thus the user should be authenticated both with Facebook and on the server (Django), and the server should have the user's Facebook authentication token.
What would be the best flow for authenticating the user on both sides? Is it reasonable to authenticate on Facebook via mobile app, then send the token to the server and create a django session on the server?
I had a similar requirement: jQueryMobile app with Ruby On Rails backend. In my case, I implemented the Facebook authentication on the backend using omniauth. The backend retrieves the Facebook access token and passes it to the jQueryMobile frontend. The frontend then uses JSONP to retrieve the user's friend list. The advantage of this approach is that there is a single point of authentication -- Facebook auth at the backend.
You can find a demo of my app and the full source code at http://csgrad.blogspot.com/2011/07/jquerymobile-app-with-facebook.html

can facebook authentiation tokens be shared between applications

I have a mobile app that allows users to login through facebook connect.
There is also a webservice that the mobile app will use.
Can the mobile app share its auth token with the webservice?
user login to facebook through mobile app
mobile app sends auth token to webservice
webservice queries facebook for user details
or would the mobile app query facebook and then pass the information to the webservice?
user login to facebook through mobile app
mobile app queries facebook for user details
mobile app sends details to webservice
Yes. The API doesn't care where you get the token from, as long as you're using the same AppID/Secret. This is commonly used in offline data access scenarios (user authenticates through web app, backend service updates in background). Do you have a specific example where this doens't work?