Logo for the site

How to setup authentication in Firebase

  • #Firebase
  • #Firestore
  • #React.js
  • #Auth
call-n

call-n

1 min read
How to setup authentication in Firebase

How to setup Firebase Authentication and links to related articles. This example is in React.js and I recommend that you read How to setup Firebase in your code before you read this. All code is found on GitHub for reference.

This is a really short article, this will only contain how to configure your `config.js` file and the links to all the other articles on authentication.

Let's move on, first we have to import the `firebase/auth` module in the `/Firebase/config.js` file with the function `getAuth`. Like this:

import { getAuth } from 'firebase/auth'

Then all we have to do is to invoke it and export the auth constant we declared:

// initialise authentication service
const auth = getAuth()

export { auth }

Enable Firebase Auth on the cloud

First of we need to navigate to our `console` in the cloud and click on the `Authentication` link in the `Build tab`. When we do that this view pops up:

Authentication tool page for Firebase

Then we want to procced by clicking on the `get started` button, after this we will be sent to this screen and we want to choose `Email/Password` for this custom hook.

Authentication selector page for Firebase

Then they will ask you to enable this setting and like in the image below just enable the one with `Email/Password` for now. Procced by clicking on the save button then you are all done!

Authentication selector page for Firebase

And that's it! Now the authentication service will be up and running so you can just import the config file anywere in your project to get started.


call-n

Written by call-n

An engineer with a some years of experience, specializing in frontend systems like React.js and Next.js. Very intrested in the backend too ☺️

call-n

Passionate software engineer trying to learn as much about code and design

Links

All rights reserved © calo.dev 2022