Why I Decided to Use Firebase, and an Interesting Error I Got Because of 3 Characters
Before I get into the Firebase error I got, or more appropriately the error I didn’t get but should have gotten, lets discuss why I chose Firebase in the first place.
I recently decided to use Firebase to do authentication and database storage for a few apps I am working on. Both for myself and some freelance clients. Firebase was my choice for three reasons:
- The backend for the auth and database storage is already done and well tested.
- I planned to sell the apps, so paying money for Firebase if I go over their free limits isn’t a big deal.
- Parse is no longer an option. I had been planning to use it for these apps for a while and was disappointed to find out it was being discontinued.
While researching Parse alternatives, I came across a tutorial on Ray Wenderlich’s site, and became intrigued by Firebase. Finding out it was a Google product increased my interest, since in my experience Google puts out fairly good products.
So, after doing a little research, I decided upon Firebase and set to work creating an abstract project. Once done I’m turning it into a framework, and then a cocoapod, for use in future apps. This app would do user login/authentication, user account creation, password reset requests, and database communication.
My Journey With Firebase
First I started working on the sign in screen and user creation screen.
The UI is pretty simple for both. It is just a series of TableViewCell’s with text inputs used to create, or sign in to their account. I had to add some extra inputs on the creation screen because I want to add new users to my email list unless they opt out.
Because I planned on the entire project being used for multiple projects in the future, it was fairly simple to abstract everything out and make the data collected by the app adjustable by simply changing certain constants all contained within a specific file.
Now that I have everything abstracted, but also concrete by setting the specific constants to what I plan to use for several apps, I was ready to finally test creating an account. Once I had an account created I could start testing the login screen – an important thing to note here is that I didn’t want to create an account through the webpage console for Firebase, I wanted to do it solely through the app … remember this point because it become significant.
Testing the Account Creation
So, I’m ready to go, run the app click the account creation button, and fill out the form.
Because I am doing this on my phone, I really dont want to type all my actual information out. So I used strings like “asd” for both names – the name fields were just random letters. The email was “firstname.lastname@example.org” because it was quick and much easier to type than my real email.
The last part of the form is a password which I didn’t want a full, long, real password for testing, so I used “bim” because it was short and I could remember it.
I finally clicked “Create Account” and waited for the magic, which never happened.
Dang! Now I get to pore through documentation and find out whats going on.
What Went Wrong, and What I Did to Fix it
Usually the Google machine and Stack Overflow keep me going. If something doesn’t work, they almost always have the answer. This moment marks the second time I’ve been let down by the two of them. Though SO did eventually rescue me from the first one, but I had to actually ask a question instead of just search through answers.
Firebase documentation states specifically that if there is no error returned by the create account call, then the account was created successfully. The only problem was I was getting no error, nor was the account being created! I FRIGGIN BROKE FIREBASE!?!?!
Almost, but not exactly. After searching for multiple hours for a solution, and finding zero helpful information, I accidentally stumbled upon the problem. I tried to create the same account on the website – the thing I wanted to avoid doing – and got a freaking error.
What The Crap Google! Here I am not being sent an error – but the website is throwing an error. Everything was the same on the app and the website.
So, what went wrong you may be asking yourself … The password was the problem.
Firebase Password Documentation
The Firebase docs say that any password authentication needed to be done by me before creating the account. For these particular apps I am currently working on, I really don’t care if people use a 1 character password – so I assumed that since it was left to me, there were no restrictions placed by Google, but there are.
Firebase passwords must be 6 characters or more. This is the error message I finally got while trying to create a password online. Tried this in the app and bam, works like a charm.
Why oh why does this not throw an error – or at least have a mention in the documentation somewhere. I am actually going to write Google about the issue and ask them to update the documentation or cause an error to be thrown by the app.
In the meanwhile I am putting this here – as well as Stack Overflow. That way any other unsuspecting people can find a possible solution to their problem.
If you like what you see and want to keep updated, as well as be informed about when I release new freebies, sign up for my newsletter below for more tips and advice on growing an app business.
Latest posts by Doug Watkins (see all)
- CodeFights and Re-Learning About Bit Manipulation - October 20, 2016
- Firebase Account Creation Failure Without an Error - October 13, 2016
- Using Kickstarter to Vet an Idea - June 1, 2016