3

I'm using phonegap build to compile the example facebook connect app located here The app loads fine on my phone, however, when I click the login with facebook button, it looks like it will work for a second and then I get the error {"errorMessage"}:"Facebook error: Session was closed and was not closed normally"}

I have done all the steps Dom has outlined here

I have uploaded a keystore hash to both facebook and signed the app on phonegap build and its still not working. Any help would be appreciated. thanks.

Community
  • 1
  • 1
user3151798
  • 43
  • 2
  • 6

4 Answers4

4

Probably an issue with your hash in my experience.

Looks like you've already read them, but see the Facebook instructions here - there are lots of things that can go wrong:

  1. Make sure you have openssl installed (type openssl at the command line and see if it errors)

  2. Assuming you're on Windows, run this command, ensuring you replace YOURUSER correctly: keytool -exportcert -alias androiddebugkey -keystore "c:\users\YOURUSER\.android\debug.keystore" | openssl sha1 -binary | openssl base64, and copy the printed hash (including '=' at end)

  3. Go to https://developers.facebook.com/, select your app, go to Settings > Android, paste into Key Hashes, then click 'Save Changes' at the bottom

  4. While in your Facebook Android settings, check that your package name is correct

  5. Deploy a debug version to your Android phone using Cordova/PhoneGap (i.e. no --release argument)

Good luck!

Dunc
  • 18,404
  • 6
  • 86
  • 103
  • What is `androiddebugkey` ? – MaicolBen May 04 '15 at 20:50
  • 1
    @MaicolBen From http://stackoverflow.com/a/18590149/188926 - "The Android build tools provide a debug signing mode that makes it easier for you to develop and debug your application ... Caution: You cannot release your application to the public" – Dunc May 05 '15 at 10:21
0

Problem is with key has. If you have Android Studio installed and you can see logcat when you try to login there will be an error. In that error will be a key has which must be added in facebook app.

0

Problem is with phonegap-facebook-plugin\platforms\android\res\values\facebookconnect.xml

You need to manually add this in facebookconnect.xml

<resources>
    <string name="fb_app_id">xxxxxxxxxx</string>
    <string name="fb_app_name">namespace or display name</string>
</resources>

I wasted 2 days for this and everywhere was suggesting me to check keyhash

This is documentation :- https://github.com/Wizcorp/phonegap-facebook-plugin/blob/master/platforms/android/README.md

Kamal Kumar
  • 3,393
  • 2
  • 19
  • 15
-1

Indicates that the Session is closed, and that it was not closed normally. Typically this means that the open call failed, and the Exception parameter to StatusCallback will be non-null.

Stephen Ngethe
  • 1,034
  • 13
  • 24