Welcome to my blog!


Written By Tyler Jones

Firebase Authentication Cookies for Subdomain Support

I’ve spent this last week trying to find a way to add CSRF protection on my Next.js application that uses Firebase Authentication session cookies. Now, before you ask, I plan on sharing the session across wild card sub domains all based on the same application (similar to how Medium gives you a custom URL: username.medium.com). Firebase does not support this out of the box and I found adding api middleware to every request or wrapping each component with cookie middleware tedious and a bit frustrating…. Not as frustrating as it was to figure this out though -_- .


Mocking functions with Jest

Mocking with jest is just as it sounds, a way to simulate the behavior of modules or functions. This is especially useful when testing external dependencies, API’s, and asynchronism.


Quickly Set Up Multer For Node File Parsing

Starting with plain HTML we use an input with type='file'


Next.js + Firebase + Auth

There are a couple of firebase auth packages that help with authentication. One is Next.js specific and auth specific called next-firebase-auth and the other provides functionality for firebase as a whole. Designed for react, reacfire has methods for lazy loading, retrieving docs, …etc. reacfire also has methods to sign in and logout (not sure about 0Auth though) may want to create a custom package?!?! May want to use firebase directly then develop custom package?!?!


How to Setup Firebase With Next.js

To get started we need to install two dependencies with npm install or yarn add.