Get Facebook login status and signed request without JS SDK

I'm developing a mobile app with Cordova 3.0.9, and a Rails backend.

Right now I'm implementing the authentication part, and been able to implement a client-side Facebook authentication with the help of the InAppBrowser plugin and get the access token for the user.

My question is, as I'm using Omniauth for the server authentication and need to make a post request to my callback end point (/auth/facebook/callback) with the signedRequest as a param for Omniauth to work its magic:

How can I get the signedRequest token from Facebook without using JS SDK, possibly with a simple get request to some url. Normally this would be accomplished with a FB.getLoginStatus request, but I can't manage this to work in the mobile environment.

Thanks in advance.


I managed to accomplish what I wanted.

It happens that after the initial request sent to

/auth/facebook

with the access token from facebook, he then makes a call to

/auth/facebook/callback

To finish the authentication with the signedRequest token from omniauth.

Once I'm on my sessions controller on my Rails backend I can inspect the request object in order to find the tokens, along with the initial params sent to the first request.

This way I was able to find the

"omniauth.params"=>{"format"=>"json", "provider"=>"facebook", "code"=>"..."} 

And respond with json accordingly when the request is sent from my App.

链接地址: http://www.djcxy.com/p/54116.html

上一篇: C ++运算符是新的还是新的[]抛出std :: bad

下一篇: 在没有JS SDK的情况下获取Facebook登录状态和签名请求