Phonegap build facebook connect plugin (android)

I have a weird problem using facebook plugin with phonegap assembly. This sounds like a certificate issue, but I can't figure it out.

I tried the example code found here: github.com/amirudin/pgb-fbconnect

I followed the instructions in the readme.md file.

When I first launch the Android application, and when I click the "Login" button, everything works fine, and I can connect to the facebook application.

Now I pressed the exit button. Ok, that works.

But if I pick up the login button again, I get a facebook error message: "invalid android_key_parameter. The key xxxxxxxxxxxxxx does not match the allowed key."

But the key xxxxxx in the message does not match the key that I set in the settings panel of the facebook application.

I have a short video about my problem here: Video from Dropbox

I do not understand why it works normally during the first login and does not work during the second. It seems like a second time signature change.

Help !!

I created a github repo if someone wants to test it. You just need to change APP_NAME and APP_ID in config.xml and APP_ID in index.html

It is unfortunate that there is something that "almost" works.

Did you manage to reproduce my error / behavior? (login + logout + login = fail)

+3
source share
1 answer

The problem that you encountered because of you is not using the correct key file, signature, and key algorithm. You will need to create a hash of your Android key (s) and send them to the developers page on Facebook.

If you generate this hash on Windows (in particular, 64-bit versions), use version 0.9.8e or 0.9.8d of OpenSSL for Windows, not 0.9.8k.

Once you download openssl, open a command prompt (cmd.exe) as an administrator, then run the following command:

keytool -genkey -v -keystore [keystore_name].keystore -alias [alias_name] -keyalg RSA -keysize 2048 -validity 10000 

Pay attention to alias_name and save all andriod passwords

Now go to your phonegap account → edit the account → Click on the key signing tab → Click “add key ...” and put the following information:

 Title - anything Alias - alias_name that you have given while generating the keystore file. 

Then create a new hash key using the keystore file you created, and then update that hash key in your facebook application.

Use the command below to generate the hash key.

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

It should be!

+1
source

Source: https://habr.com/ru/post/977342/


All Articles