user3151798
user3151798

Reputation: 43

facebook error: session was closed and was not closed normally (phonegap build / facebook plugin error)

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.

Upvotes: 3

Views: 1939

Answers (4)

Kamal Kumar
Kamal Kumar

Reputation: 3763

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

Upvotes: 0

Raoul Cimpean
Raoul Cimpean

Reputation: 116

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.

Upvotes: 0

Dunc
Dunc

Reputation: 18932

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!

Upvotes: 4

Stephen Ngethe
Stephen Ngethe

Reputation: 1044

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.

Upvotes: -1

Related Questions