Home > Uncategorized > com.facebook.http.protocol.ApiException: Key hash does not match any stored key hashes.

com.facebook.http.protocol.ApiException: Key hash does not match any stored key hashes.

fb-androidI’m not alone in the type of developer who things he understands how something works without reading instructions, and this is certainly a lesson in reading instructions before banging you head off a wall trying to fix a problem that was solved by reading the next paragraph.

But, the diagnostic technique may help someone else.

I was trying to get the Android Facebook SDK to get up and running, with a view to then move onto the Phonegap Facebook Plugin. But quite naturally, I knew that I would have to get the base level Facebook SDK examples to work before moving on to the Phonegap plugin.

So, I installed the Facebook Android SDK, imported the projects into my workspace, and tried to run the first one, Friend Picker, and lo and behold. Nothing. Nada. No worky. Just a prompt asking me permission, then nothing else.

I tried then connecting a real android device. Same result. #

I checked in LogCat, and scrolled up to the first mention of a Facebook related error and got this:

04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): com.facebook.http.protocol.ApiException: Key hash bBZxOcCkWDdGSW8zex5GXuvuwpY does not match any stored key hashes.
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.ApiResponseChecker.b(ApiResponseChecker.java:83)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.ApiResponseChecker.a(ApiResponseChecker.java:162)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.ApiResponse.g(ApiResponse.java:151)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.platform.auth.server.AuthorizeAppMethod.a(AuthorizeAppMethod.java:275)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.platform.auth.server.AuthorizeAppMethod.a(AuthorizeAppMethod.java:31)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.ApiResponseHandler.a(ApiResponseHandler.java:55)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.ApiResponseHandler.handleResponse(ApiResponseHandler.java:28)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:314)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:144)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.common.FbHttpRequestProcessor.b(FbHttpRequestProcessor.java:100)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.common.FbHttpRequestProcessor.a(FbHttpRequestProcessor.java:230)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:402)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.SingleMethodRunnerImpl.a(SingleMethodRunnerImpl.java:164)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.http.protocol.AbstractSingleMethodRunner.a(AbstractSingleMethodRunner.java:18)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.platform.common.server.SimplePlatformOperation.a(SimplePlatformOperation.java:40)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.platform.common.server.PlatformOperationHandler.a(PlatformOperationHandler.java:60)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.fbservice.service.BlueServiceQueue.e(BlueServiceQueue.java:329)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.fbservice.service.BlueServiceQueue.d(BlueServiceQueue.java:55)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.fbservice.service.BlueServiceQueue$3.run(BlueServiceQueue.java:258)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at com.facebook.common.executors.ListenableScheduledFutureImpl.run(ListenableScheduledFutureImpl.java:59)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at android.os.Handler.handleCallback(Handler.java:733)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at android.os.Handler.dispatchMessage(Handler.java:95)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at android.os.Looper.loop(Looper.java:136)
04-08 04:50:01.757: W/fb4a(:<default>):BlueServiceQueue(1711): at android.os.HandlerThread.run(HandlerThread.java:61)
04-08 04:50:01.797: D/dalvikvm(2292): GC_FOR_ALLOC freed 467K, 15% free 3196K/3736K, paused 360ms, total 366ms
04-08 04:50:01.997: W/CursorWrapperInner(2292): Cursor finalized without prior close()
04-08 04:50:02.107: I/Choreographer(382): Skipped 31 frames! The application may be doing too much work on its main thread.
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): Failed to send
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): com.facebook.fbservice.service.ServiceException: API_ERROR: API_ERROR
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at com.facebook.fbservice.ops.BlueServiceOperation.c(BlueServiceOperation.java:639)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at com.facebook.fbservice.ops.BlueServiceOperation.c(BlueServiceOperation.java:47)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at com.facebook.fbservice.ops.BlueServiceOperation$2.run(BlueServiceOperation.java:604)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at android.os.Handler.handleCallback(Handler.java:733)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at android.os.Handler.dispatchMessage(Handler.java:95)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at android.os.Looper.loop(Looper.java:136)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at android.app.ActivityThread.main(ActivityThread.java:5017)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at java.lang.reflect.Method.invokeNative(Native Method)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at java.lang.reflect.Method.invoke(Method.java:515)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-08 04:50:02.137: W/fb4a(:<default>):GDPDialog(1711): at dalvik.system.NativeStart.main(Native Method)

Finding the first reference (highlighted in bold) was

com.facebook.http.protocol.ApiException: Key hash does not match any stored key hashes.

So, I searched for that online, and realised I hadn’t read all the instructions, you have to enter in the hash provided (base64 padded) to https://developers.facebook.com/settings/developer/sample-app/

– Which is generated from DOS, like this:

C:\OpenSSL-Win32\bin>keytool -exportcert -alias androiddebugkey -keystore %HOMEP
ATH%\.android\debug.keystore | openssl sha1 -binary | openssl base64
Enter keystore password: android
bBZxOcCkWDdGSW8zex5GXuvuwpY=

Obviously, this means that I’ll have to re-do this step whenever I’m using my signing key. Hopefully that’s not going to be a problem…

Advertisements
Categories: Uncategorized
  1. May 15, 2014 at 10:33 pm

    failed to log in.

  2. May 15, 2014 at 10:36 pm

    failed to login to my facebook.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: