Tackling authentication errors are tough.

Tackling authentication errors are tough.

ยท

3 min read

Hello Everyone! We all know how hard and stressful debugging can get sometimes, especially when you have a small bug in your codebase.

We try to get through the code multiple times, testing it and running it again and again and sometimes even without making any changes to the code but feels like we're on a dead end and that's when we see a small silly error like wrong variable name or a missing semicolon and start going crazy.

Something same happened to me while working on yet another side project that'll most likely be unfinished and will never be touched again. So in this project, I was trying to implement authentication with phone number and OTP using firebase.


The Error

Everything seems to be working fine, I didn't receive any errors and tried to run the code for the first time, I got the OTP on my mobile number and thought everything would be working fine but how can it run on the first attempt that's what I thought and entered the OTP, nothing happened. If everything was fine it should be redirecting us to the home page. So I opened up the console in hopes of seeing an error that needs to be resolved but it was blank just like a developer's life.

I was like -


The Code

Here is the code that I had, can you see the error?

If you saw the error, then congratulations you have an eye of an eagle that can survive a stealth attack from a leopard while enjoying safari only if you get a life as a developer.

The fixing of the error

Let's come to reality, After spending half of my day on this error and searching the whole StackOverflow. I thought of giving up and closed my laptop. But as a developer, you won't be able to sleep till it's fixed. So I opened it again and start going through my code line by line.

I noticed that there can't be an error in the requestOTP code, so there must be an error in verifyOTP because we're receiving the OTP but not able to confirm it, so I was going through line by line and saw the line no - 50 and went crazy. It was this little thing top that was creating the error. It should be otp.

Finally fixed it without breaking my keyboard and head.


Conclusion

Some errors can annoy you while some can take significant time of yours but some can make you break your head. Debugging can be hard sometimes but It is was make the programming fun, breaking changes and fixing them, having bugs in your app and calling it a feature.

I hope you enjoyed reading this, I don't know who read it throughout but if you did drop a like, comment and follow so I can know about it.

If you ever find yourself where you're not able to fix the problems, take a small break and get your mind free of all thoughts and start working on it from the start.

It is not only about coding but life as well.

Did you find this article valuable?

Support Aryan Srivastava by becoming a sponsor. Any amount is appreciated!

ย