Search code examples
javaandroidfacebookhashparse-platform

ParseLoginUI Facebook Integration - Stored Hash Keys Don't Match


I've been following the ParseLoginUI tutorial here: https://github.com/ParsePlatform/ParseUI-Android/tree/master/ParseLoginSampleWithDispatchActivity

In my AndroidManifest.xml, I have:

<activity
    android:name="com.parse.ui.ParseLoginActivity"
    android:label="@string/app_name"
    android:launchMode="singleTop">
    <meta-data
        android:name="com.parse.ui.ParseLoginActivity.PARSE_LOGIN_ENABLED"
        android:value="true"/>
    <!--<meta-data-->
        <!--android:name="com.parse.ui.ParseLoginActivity.PARSE_LOGIN_EMAIL_AS_USERNAME"-->
        <!--android:value="true"/>-->
    <meta-data
        android:name="com.parse.ui.ParseLoginActivity.FACEBOOK_LOGIN_ENABLED"
        android:value="true"/>
    <!--<meta-data-->
        <!--android:name="com.parse.ui.ParseLoginActivity.TWITTER_LOGIN_ENABLED"-->
        <!--android:value="true"/>-->
</activity>

...and:

<meta-data
    android:name="com.parse.APPLICATION_ID"
    android:value="@string/parse_app_id" />
<meta-data
    android:name="com.parse.CLIENT_KEY"
    android:value="@string/parse_client_key" />
<meta-data
    android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/facebook_app_id"/>

In my GlobalApplication class, I have:

ParseFacebookUtils.initialize(this);

I realize this looks like a hash key problem, but I've tried hashing and re-hashing using various methods found here: Key hash for Android-Facebook app

I'm hoping it's not something as trivial as messing up my hash keys, because I've triple checked these. Is there something wrong with my code?

What is the problem here? See attached image below:

enter image description here
(source: elgami.com)


Solution

  • I figured it out! Hopefully this helps others as well. There was nothing wrong with the way I generated the hash keys. I just wasn't using a signed release build while testing for the Facebook hash. Make sure you generate a signed APK, copy the APK into your phone and install it, then open the app. When you attempt to login with Facebook you will still see the error, but displayed will be the correct hash key, and you will want to add this exact value into your Facebook app dashboard as your production hash!