I am making a demo project where integrating linkedin. In the developer site of linked in added hashkey and package but still getting {
"errorCode": "INVALID_REQUEST",
"errorMessage": "either bundle id or package name / hash are invalid, unknown, malformed"
}
Please note:i have seen many blog and question in the stackoverflow but still unable to resolve. and yes m entering correct package name and hash key.
If you have Generated a debug key hash value.
If you've added all you package hashes correctly in your LinkedIn Developer Console.
And finally you might want to save changes by clicking the blue button labelled "Update".
Test your app again
The problem is most likely your hash key, try generating it using the below code.
Try this code in your MainActivity
try {
PackageInfo info = getPackageManager().getPackageInfo("Package name",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.e("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch(PackageManager.NameNotFoundException| NoSuchAlgorithmException e) {
}
Related
I tried to use Facebook login in my app.
But I have this problem only on my physical android device. (not a virtual device)
How can I fix it?
You need to setup the key hash in the facebook App Dashboard. To get the signature key hash,
just call the method below in your App in a release build (no publishing required) and run your app - in Logcat you can see the output.
After this you can remove the method.
If you want it also to work for debugging purposes do the same in a debug release. Because the hashes are different.
private void printKeyHash() {
try {
PackageInfo info = getPackageManager().getPackageInfo(getPackageName() , PackageManager.GET_SIGNATURES);
for(Signature signature:info.signatures){
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("Signature", Base64.encodeToString(md.digest(), Base64.DEFAULT));// <--- signature
}
} catch(Exception e) {
e.printStackTrace();
}
}
In Facebook App Dashboard enter the hashes. And don't forget to switch the App Mode to live after your app is released
In my application i want to integrate the facebook. I wrote all the code for this.But whenever i click the facebook login button it showing one popup like "Invalid key hash and the key hash XXX does not match with any stored key hash"
If my mobile not having facebook application, then it is working. If my mobile is having facebook app the facebook integration is not possible to me.
for hash key: (oncreate)
try {
Log.v("TAG_PACKNAME",""+"UUUU");
PackageInfo info = getPackageManager().getPackageInfo(
"Your package name",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.v("TAG_PACKNAME",""+ Base64.encodeToString(md.digest(), Base64.DEFAULT)); // not printing
}
} catch (PackageManager.NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
i got hash key and release key too. i added both developement key and release key in facebook console. But whenever i click the facebook login button it pop ups like "invalid hash key. the hash key not matched with already stored hashkey"
please any one help me out.
I have been trying to implement facebook share from my android application. I have gone through this documentation.
https://developers.facebook.com/docs/android/share.
I have successfully integrated my development key hashes for once and successfully shared to facebook from my application. The problem is when I am trying to implement the same steps for my another application. I have successfully added my key hashes and linked up my application with facebook but when I hit "POST", it is showing that Key hashes does not match and the key hash that is coming with the error message is showing the previous application's key hash.
I have double checked my key hash using this.
try {
PackageInfo info = getPackageManager().getPackageInfo(
"My Project",
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));
Toast.makeText(this, Base64.encodeToString(md.digest(), Base64.DEFAULT), Toast.LENGTH_LONG).show();
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
Any solution ?
That's because you have 2 Key hashes.
One for Debugging and the second is for release, when you publish your application to Google Play using a custom-made keystore instead of the Android Debug one.
Your scenario sounds like your are running your application from Eclipse/Android Studio and when you do that you are using the Debug keystore key hash which you have probably included in Facebook Developer Console already like in your previous app.
If you are exporting your APK with a different keystore you will have to get its Hash Key for this specific key store, like in the online examples you mentioned above.
I will be happy to know if you are signing your APK with debug keystore or your own. That will make things more simpler to answer.
I am creating an Android app that will integrate with Facebook. I have been able to successfully generate a Key Hash, and when I run my app to log in, I successfully got to the accept permissions button. I clicked accept and since then, I haven't been able to log back in from the app. I am given the error "(insert the key has i'm using here) does not match any allowed key. Configure your app key hashes at (lists my Facebook developer URL)". Is there any reason why a Key Hash would work and then would just stop? I did not alter any facebook settings and did not alter any application code. I've tried creating a new key hash, but that still didn't work. Any ideas on what this could be, or how to resolve it would be greatly appreciated!
I figured this out. Somehow, the Hash Key just stopped matching what I had inserted on the Facebook side. Using the facebook documentation, I added in code in my onCreate method that told me what the hash key was in my LogCat. I also added in some logging code for my catch exceptions in the event that I was screwing up my package name. This is the code:
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.your.package",
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) {
Log.d("Error1", "NameNotFoundException");
} catch (NoSuchAlgorithmException e) {
Log.d("Error2", "Algorthim");
}
After I added that and ran it, I found the hash key in my log cat, and then just copied that to my Facebook App. Saved it, ran the app again and it worked!
This question already has answers here:
This app has no Android Key hashes configured. - Login with Facebook SDK
(5 answers)
Closed 7 years ago.
When i run my facebook apps i get the following error. allow key. Configure your app key hashes at http://developers.facebook.com/apps/178779105632639 ...
Any idea?
It seems that hashkey you generated is not correct. You can generate app hash key from the following code. Try it
public static void showHashKey(Context context) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
"com.example.project", PackageManager.GET_SIGNATURES); //Your package name here
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.v("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
}
1.It will Help you.Working fine link
2.while creating app, in developer site using some keyhash generated by your cmd prompt,use that KeyHash copy and paste
in developer Settings Page keyhash Column.
3.change the Single sign on toggle button-YES
You need to generate a hash key for your application and register that to the FB Developers console where you have created the application. I have written a blog for the same. You can find it out at :
http://www.solutionanalysts.com/blog/android-generate-key-hash-facebook
Hope this helps you.