Facebook authentication for both mobile & web app in Cakephp - facebook

Can anyone help me to overcome this hurdle..
My Situation:
I have a webapp (Facebook app) in cakephp, which will b accessed only after Facebook authentication(Its working cool).
& now I have a mobile app & which will work on restapi, I want the same above webapp code to be served as RestApi.
Now I'm able to do authentication for mobile app with facebook, I need to authenticate my webapp which will server as rest api(unless I cannot use the code inside the app)..
Requirement:
I have access_token & user_id with me sent by facebook to my mobile after successful login, & How can i authenticate my web app with these two..??
Can anyone look into this & help me to comeout..!!?

If you want to access Facebook data from inside CakePHP you have to send the access_token & user_id to CakePHP. You probably should narrow down your problem to a specific error or method that fails, here it's not really clear where your problem lies.

Related

How to Laravel mobile app api for facebook login

Hi i'm working on a web with Laravel. On the web, I use socialite to login with Facebook, but I don't know how to do that with api for mobile to connect.
On the web, the flow is the user request to the website, socialite will redirect to facebook to obtain data and redirect back to the redirect url that we register to do authentication.
I don't know if with mobile app is the same?
How can I do it since there is only 1 redirect url and how to detect if the request is from website or from mobile app. Because request from website, ultimately is return view and request from mobilr is return json, right?
Or the mobile side, mobilr developer will do the obtaining data then send it to the website through api to authenticate?
Please help me on this. Thank u. Sorry for my bad English. If anyone does not understand my situation please ask me again.
Thank you all.
If you are building a mobile app, you should use the Facebook Mobile SDK to preform Facebook login instead of doing it the website way. On Facebook, you can have different settings for iOS and Android (and other platforms), so you won't need to worry about knowing which platform the user is using.
When the user authenticates using the mobile app, you can pass the Facebook access_token back to your database via an API.

Facebook Signed_request invalid via mobile app

We have an fb canvas made from .net mvc that works well via desktop but it doesn't work well in mobile app. We send request then if someone on fb mobile tap on request and opens up the web app, the signed_request returned is different than the desktop counterpart. The payload is missing and it seems shorter than the desktop's. I'm trying to read it as "code" and try getting auth token via https://graph.facebook.com/oauth/access_token?client_id=xxxx&code=[code]&redirect_uri=???. The problem with this is I don't know what the redirect_uri supplied or maybe it's not a code.
Can you guys help me with this or there's no other way but once they click request via mobile app we have them relogin in our web app to grab their fbuserid? And if there's another approach in handling mobile app requests.
Mobile Web URL and the signed_request
This is already outdated so maybe there's a solution already.
Thank you
I'll answer my own question. What you can do is add an extra authorization in your login flow when then access your canvas url via facebook mobile app. You send them to
https://graph.facebook.com/oauth/authorize?client_id=
passing the redirect uri and scope then grab the new generated "code" param and grab the aut token via graph api. Then you can access their facebook detail as you would normally. I've read answers like there's no signed request in mobile web and approach it differently without stating what that approach is. Hope someone can be helped by this answer.
Thanks

OAuth strategies for Facebook/Google services in mobile app with Rails background

I'm developing some iOS app with Rails background. I want to allow users authorizing through Facebook or Google. User mush be authorized before he will be able to make comments and estimate posts. It's my first experience of working with OAuth, then, please, check my steps for client-server architecture:
The App gets token/user_id from FB or Google
With every request (which requires authorization) to the server the
app must send user_id and token
The server checks if the token is valid
If all is good the server responds some data; if token is not valid
the server returns an exception code.
Please, tell me any advice you think is good. Thanks in advance.

Yii facebook login issue

I have created an facebook application in Yii and make user(s) login to my application using their facebook credentials .I'm using OAuth for facebook authentication and it's works fine on local server but doesn't work on php AppFog server. Link to my application is http://nettantra-cvbuilder.aws.af.cm/ .
Can any body tell what will be the problem .
This is probably because the URLs in your Facebook App are incorrect. You need to replace those with the final ones in the App settings (at least 'Site URL' in 'Website with Facebook Login').

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