This is a problem indeed. I had this problem just yesterday and with some research, I managed to fix this sneaky bug. In this post, I want to explain to you how I fixed this bug and so when people come across this problem they can always refer to this post.
After I was done creating my application, I was very excited, because it was my first application. So as I was very excited and placed a message on LinkedIn and Twitter with the news that I just launched my application, I got a message. The message was not about how good my application was, instead people could not log in.
Now every part of me was just like: “NOOOOOOOOO!!!”. Yes, that is exactly how it went. The problem was, I tried to log in a million times before I launched the application and it worked just so fine. I did not worry about the login at all.
So I needed to solve this problem. I decided first to test it on my own device and it was very frustrating to see the message: “Sign in failed!”. At that moment I even thought about removing the sign in page. Well, I am happy that I did not do that. Instead, I learned a new thing and I am very proud that I fixed the bug instead of scraping it.
How to fix this bug
Luckily, we have Stackoverflow. So I did some research and I found an answer that would fix my bug. The problem was executing the steps. I never ever done this stuff before and I was overwhelmed, but after I did it, I found out that it was pretty simple.
I used Firebase for my sign in methods. Well, if you go to your Firebase console, you have a page called “project settings”. The way to get there is by going to your: Settings -> project settings.
Once you are there, you can see this:
The thing that we need to change is the SHA1 certificate. The one you used before you placed your application, will not work and for this reason my sign in crashed.
Well the question remains how do I get this SHA-1 certificate fingerprint?
SHA-1 certificate fingerprint
After some research and reading different answers to my question, I finally found what I was looking for. So here is the URL: MAKE IT WORK!
Once you followed all these steps that are described in the URL, now it is time to change the SHA certificate fingerprint in your Firebase console.
So once you have done that, you need to remove the older one that you had. Now it is time for the final steps.
Download the new config file. Like this:
Click the download button and save this file somewhere you know you can find it easily.
Now it is time for the final step, which is including our google-services.json file into our project.
Well, this is the final step.
- Go to the projects folder
- aste the google-services.json file into your app folder
- You need to see the google-services.json file where my last arrow is pointing.
Now rebuild your android application and you are good to go!
This issue can really be a pain in the ass. If you follow all the steps which I told you to follow, you will have your sign in working before you know it. Just make sure that you follow the steps in the link that I have included, about getting an SHA-1 certificate fingerprint. This step is really crucial to make it work.
Hope you enjoyed the post and please feel free to add a comment about how it went. Happy coding!
If you are curious about my application, feel free to download it on your mobile phone and tell me what you think about it: Healthyness.