How to use Facebook access token in android app webview

后端 未结 3 2052
野趣味
野趣味 2021-02-07 00:10

In my application, the user opens a WebView to the mobile versions of facebook profile page (http://m.facebook.com/some_page). My problem is that when opening the <

相关标签:
3条回答
  • 2021-02-07 00:36

    Read this project carefully and try...I tried this example in my project ..It works..

    Bu before you taking this example, You have to create a page in facebook and get an application-id, to use in this project

    https://github.com/ddewaele/AndroidFacebookSample

    0 讨论(0)
  • 2021-02-07 00:38

    You can store that AccessToken separately in Properties and check if you use webview then pass that accessToken and when user use Ti.Facebook then use another AccessToken.

    0 讨论(0)
  • 2021-02-07 00:39

    From my understanding, you can't. The access token you get for your app can only be used in conjunction with the API credentials of your App. I.e. the access token only works in calls that also contain your app's key and secret. Even if you could find a way to pass these into a WebView (which is most probably not covered by FB's Data Policies), you'd probably have to make the WebView pretend to use the Android SDK (because FB would check the call's source). That's why I suggest you can't.

    You also cannot have the WebView use the user's cookies he might have in his stock browser, as each WebView has it's own context for security reasons.

    If you're frequently using a WebView for FB in your app, you might be able to pull the auth cookie out of the first WebView, and then insert it into subsequent instances using CookieSyncManager. Or you could save the instance state of the first WebView and then reuse it. These are just ideas that might or might not work; I haven't checked them out.

    0 讨论(0)
提交回复
热议问题