Question

This question has been asked before but not in this context to my knowledge.

My problem is, I reinstalled my OS (Windows 8.1) and so had to reinstall my Android Studio.

I did backup my project and reimported it to my new installation. So I then got my new debug key and set it on the Facebook dev console. However, after pressing the "login with facebook" button it asks for the permissions then goes back to the button and does not login. Also to note the app on the dev console is out of sandbox and the app-id etc. have been set in the manifest as well as the INTERNET permission.

I obtained the debug key using this..

keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Username.android/debug.keystore" | "C:\OpenSSL\bin\openssl" sha1 -binary | "C:\OpenSSL\bin\openssl" base64

My question is can different methods of retrieving the key give different keys? and also if anyone has faced a similar or same problem how did you solve it?

thanks in advance.

Was it helpful?

Solution

As suggested by – Rarw, using this method to retrieve the debug key... gave the correct key, where as using the command prompt keytool method did not.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Add code to print out the key hash
    try {
        PackageInfo info = getPackageManager().getPackageInfo(
                "com.facebook.samples.hellofacebook", 
                PackageManager.GET_SIGNATURES);
        for (Signature signature : info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
            }
    } catch (NameNotFoundException e) {

    } catch (NoSuchAlgorithmException e) {

    }

    ...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top