facebook manual login and share and get surrent user details

414 views Asked by At

I'm creating a firefoxOS application using jquery mobile and cordova.There is no api in cordova for integrating facebook and firefox applications.

  1. I have created a app in facebook and since there is no platform for firefoxOS,I have selected "website" as my platform.The problem is that there is no url for my firefoxOS application(only index.html),that I can give as redirect url in app settings page of developer.facebook .And also the I have followed steps from this URL (//developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.3) and its working fine in the browser as I'm able to login and share and get user details. But when i copy/paste the code in my firefox project's index.html,the SDK does'nt seem to loading as none of the functionality is working.

  2. Apart from the above trial,I have done the "login" flow manually by using this URL window.open("//www.facebook.com/dialog/oauth?client_id=APP_ID&response_type=token&redirect_uri=//MY_LOCALHOST/NAME/success.html").I'm able to access the current user's ACCESS_TOKEN from the success.html which is in server,but unable to access it in my index.html(as it is not hosted anywhere).I have tried to use localStorage,sessionStorage,cookies in success.html . I was wondering if there is any way of getting the current user's ACCESS_TOKEN after i have logged in. I have used this URL https://graph.facebook.com/oauth/access_token?client_id=&redirect_uri=&client_secret=&code= (from //developers.facebook.com/docs/facebook-login/access-tokens) but it didnt help as I will be getting the access token which is redirected to success.html page which is in server.I need the ACCESS_TOKEN so as to pass as a parameter to this url https://graph.facebook.com/me?fields=id,name,email,picture&access_token=ACCESS_TOKEN in order to get the details of the user currently logged in .

But I'm able to share perfectly using this URL window.open("//www.facebook.com/dialog/feed?app_id=APP_ID&link="+encodeURIComponent(urlPost)+"&caption=&description="+encodeURIComponent(message)+"&redirect_uri=MY_LOCALHOST/NAME/success.html")with respect to the user logged even without the access_token (I dont know how its posting to the wall of the current user)

Is there any solution for the above problem? Thank you!!

0

There are 0 answers