I have upgraded my project from Firebase sdk version 5.4.4 to Firebase Sdk version 6.8.0, in unity version 2018.4.14f1. I have imported all necessary "dotnet3" unity packages into my project and taken a build and i get an error "This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [App validation failed ]". I have then generated "SHA-1" for my keystore again and added fingerprint in firebase console, tried changing project from "dotnet3" to "dotnet4" and imported all necessary "dotnet4" firebase sdk packages. Still i get the same error and i made sure package name, SHA-1 code are all correct and added, even then im facing issues regarding that. Please help me regarding this issue, if my methods are wrong or is this an open issue with sdk version 6.8.0.
1 Answers
This sounds like you need to re-upload your SHA 1 for Android development.
The easiest way to do this is to use the keytool
command installed with Java:
keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore
The password for your debug keystore will be android
, but if you're doing a signed release build (say for the Play Store), you'll want to use the appropriate keystore and credentials.
You then need to copy/paste the SHA-1 into the "SHA certificate fingerprint" field under project settings.
There is another great stack overflow answer here, but it is very Android Studio centric (you may not have it installed when developing in Unity).
I cover this at about the 5:12 mark of my getting started video if you'd prefer video instructions.
A few pro-tips before I go:
- The Android debug keystore is randomly generated on each developer's machine the first time they build and deploy a debug application for Android. This means that you'll probably want each developer to upload their SHA-1 whose working on Firebase features (alternatively, each developer may want to setup their own Firebase sandbox for development purposes).
- The combination of SHA-1 and your package name are what's used to identify which Firebase backend your game will use, so this could also be an effective mechanism to deploy separate staging and production backends.
- dotnet4 should be used in most cases now (although Unity 2018 still lets you choose between 3 and 4). Generally, if you've chosen the wrong one the error you'll see is around
Task
. This is becauseTask
didn't ship with the original version of C# that Unity used, so Firebase uses a library called Parse to retroactively add it (and make the API comparable to the Android and iOS counterparts). In .NET 4.x and higher, this means that you have two versions of Task included which will cause issues. The dotnet4 version of Firebase simply remaps any Parse specific functionality onto C#'s Task and uses the one that ships with Unity.
I hope this helps (and I hope that I properly identified the issue)
--Patrick

- 2,993
- 1
- 13
- 11
-
Thank you so much it worked....!!!!!!!! i was cracking my head with it for days now. Thank you – vicky_UnityDev Dec 24 '19 at 04:46