开发者

Problem in using facebook sdk for android

I am making my own application, which fetches data from fac开发者_如何学编程ebook using facebook graph api. The trouble i am getting is that whenever i start my application and click on login button it redirects to com.facebook.katana and invalid_key error generates. On the other hand when i uninstall the com.facebook.katana application from my phone, my application starts working perfectly fine.


Android FB SDK

Set up single sign-on

Optionally, you can make your login system more seamless by incorporating single sign-on.

  • Register your application's Android key hash. This is used by Facebook to ensure that another app can't impersonate your app when talking to the Facebook Android app.

    1. Generate the key hash:

      keytool -exportcert -alias [alias] -keystore [keystore]
      | openssl sha1 -binary
      | openssl base64

    2. In the Facebook developer settings, go to the Mobile and Devices tab.

    3. In the Android section, enter the key hash in the Key Hash field.
  • Insert a call to the authorizeCallback() method at the top of your Activity's onActivityResult() function. (If onActivityResult doesn't already exist, then create it)

@Override public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
facebook.authorizeCallback(requestCode, resultCode, data);
// ... anything else your app does onActivityResult
}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜