SlideShare a Scribd company logo
1 of 23
Download to read offline
Set up Email
Authentication Using
React Native +
Firebase Auth + React
Navigation
www.bacancytechnology.com
Build Rect Native App
Install required dependencies for
Navigation
Setting Up Firebase Project
Creating Components
Table of Contents
1. Overview: React Native Firebase Tutorial
2. What are we building?
3. Firebase Authentication Example: Steps
to Implement React Native + Firebase Auth
4. Conclusion
Overview
This beginners’ guide will help you
build a React Native application and
integrate it with Firebase. Furthermore,
we will set up email authentication
with Firebase in React Native. We all
have heard how smoothly we can build
native applications using React Native.
Let’s combine its flexibility with
Firebase and get started with this
tutorial to implement email
authentication and React Navigation
using React Native + Firebase auth.
https://youtu.be/F66J0_TrjDM
What are we
building?
We are building a basic React Native
application integrated with Firebase
Authentication that consists of Sign Up,
Login/Logout, Forgot Password, and User
Profile.
Here is the flow for authenticating a user –
whenever the user accesses the app, it will
contain the authentication state, and based
on that state; the user will have access to the
screen or the services of the app. Based on
this condition, authenticated and non-
authenticated users will have access to
different screens accordingly. Here in our
demo, we will implement authentication on
the Profile screen. It means that only an
authenticated user will visit its Profile page;
else, it will have only access to Sign Up and
Sign In screens.
Without further ado, let’s start coding!
React Native +
Firebase Auth
Example: Steps
to Implement
Firebase
Authentication
You can visit here – Github Repository and
check the code or go through this tutorial.
Follow these steps to build a React Native
app and implement Firebase
Authentication.
Create React Native App
Initially, we will create a React Native app using-
react-native init FirebaseAuth
Install required
dependencies for
Navigation
We will require stack navigation for
navigating through different screens.
npm install react-native-gesture-handler react-
native-safe-area-context @react-
navigation/native @react-navigation/stack
After this, we need to install the React
Native Firebase auth library to implement
authentication with Firebase in our react
app.
npm install @react-native-firebase/auth
Let’s set-up our Firebase Project.
Setting Up Firebase
Project
First, we need to create a Firebase Project.
Visit the official Firebase website and click
on Get Started. There you can create your
new project. After that, you will be
redirected to the Dashboard to use
Authentication Service.
Here are the images that will help you
understand the above process.
Click on the authentication on the side
menu
Select Sign-in Methods
In our app, we have to set up authentication
for email/password. For that, follow these
steps-
Select email and passwords
Enable Email and Password
Authentication by toggling the button
Provide the support mail
Save
I’ve attached an image below for your
reference.
To configure our app with Firebase, go
to the Project Dashboard, Add an app to
the project, and follow the proper steps.
Now we have all the details related to
Firebase configuration. Store these
configurations in a file named
FirebaseInfo.js
import firebase from @react-
native-firebase/auth
const firebaseInfo={
apiKey:'Your API Key',
appId:'Your App Id',
messagingSenderId:'Your
Sender Id',
projectId:'Your Project Id',
}
// FirebaseInfo.js
And then initialize the app using:
firebase.initializeApp(firebaseinfo)
Creating Components
Let’s get started with creating
components for our application. As it’s
basic authentication, it will consist of the
following components-
SignUp, Login/Logout, ResetPassword,
User Details of the currently logged-in
user, and a Navigator to move between
screens.
After entering the required details,
whenever a user clicks on the SignUp
button, it will validate and check if there is
an error related to the email registration.
Here is the logic for implementing the Sign
Up process.
Sign Up
const OnSignUp= async(email,password)=>{
Keyboard.dismiss()
if(!email)
{
Alert.alert("Email can't be empty");
}
else if(!EmailRegex.test(email))
{
Alert.alert("Email is not in the right
format")
}
else if(!password && password.trim() &&
password.length<5)
{
Alert.alert("Password is too weak and
required min 6 characters")
}
else{
try{
const Email=await
firebase.auth().createUserWithEmailAndPas
sword(email,password)
Email.user.updateProfile({displayName:use
rname})
Email.user.reload()
setusername("")
setemail("")
setpassword("")
props.navigation.navigate('Login')
}
catch(error)
{
console.log("error", error.message,
error.code)
switch (error.code)
{
case "auth/weak-password":
Alert.alert("Password is invalid,requires
min 6 char")
break;
case "auth/email-already-in-use":
Alert.alert("Email is already registered")
break;
default:
Alert.alert("Error")
}
}
}
}
Log In
Similarly, the Login screen will verify
if the user is authenticated or not. It
can be verified with the given
parameters (email, password):
const AuthUser = await
firebase.auth().signInWithEmailAndPa
ssword(email, password)
Log Out
For Log Out, we will revoke the access
from the user and let him sign out
from the app with this:
await firebase.auth().signOut()
Forget Password
If you don't remember your password,
Forget Password screen lets you recover
your password using your email-id where
Firebase will share a link to reset your
password using:
await
firebase.auth().sendPasswordResetEm
ail(email)
User Profile
The user profile will display user details (of
the logged-in user) such as email-id and
user name entered a48t the time of Sign
Up:
var
EmailId=firebase.auth().currentUser.email;
var
User=firebase.auth().currentUser.displayNa
me;
Conclusion
This was about setting up email/ password
authentication and React Navigation using
React Native + Firebase Auth. I hope the
purpose for landing on this tutorial has
been fulfilled as you've expected. If you are
looking to develop one-of-a-kind React
Native application, then get in touch with
us to hire React Native developer from us
to leverage to leverage our top-notch React
Native app development services.
Thank You
www.bacancytechnology.com

More Related Content

What's hot

An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJSYogesh singh
 
Introduccion app engine con python
Introduccion app engine con pythonIntroduccion app engine con python
Introduccion app engine con pythonsserrano44
 
Lightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and DesignLightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and DesignDeivison Sporteman
 
Mule integration with linkedin
Mule integration with linkedinMule integration with linkedin
Mule integration with linkedinKhasim Saheb
 
Create Applicationwith IIS 7
Create Applicationwith IIS 7Create Applicationwith IIS 7
Create Applicationwith IIS 7Sandeep Verma
 
How to implement multiple authentication guards in laravel 8
How to implement multiple authentication guards in laravel 8How to implement multiple authentication guards in laravel 8
How to implement multiple authentication guards in laravel 8Katy Slemon
 
How to get AWS student credit
How to get AWS student creditHow to get AWS student credit
How to get AWS student creditJungwon Seo
 
Invoicing app on ribily
Invoicing app on ribilyInvoicing app on ribily
Invoicing app on ribilyRibily
 
Filters in Mule Part-3 Message Property Filter
Filters in Mule Part-3 Message Property FilterFilters in Mule Part-3 Message Property Filter
Filters in Mule Part-3 Message Property FilterAkil Shadab
 
Write Tests in End Users’ Lingo
Write Tests in End Users’ LingoWrite Tests in End Users’ Lingo
Write Tests in End Users’ LingoIndicThreads
 
The A1 by Christian John Felix
The A1 by Christian John FelixThe A1 by Christian John Felix
The A1 by Christian John FelixDEVCON
 
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-appsJSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-appsMukul Jain
 
Building mobile applications with Vaadin TouchKit
Building mobile applications with Vaadin TouchKitBuilding mobile applications with Vaadin TouchKit
Building mobile applications with Vaadin TouchKitSami Ekblad
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplifiedVikas Singh
 
Mobile web apps in pure Java
Mobile web apps in pure JavaMobile web apps in pure Java
Mobile web apps in pure JavaThomas Mattsson
 

What's hot (20)

Salary advanceworkflow
Salary advanceworkflowSalary advanceworkflow
Salary advanceworkflow
 
An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJS
 
Ajax learning tutorial
Ajax learning tutorialAjax learning tutorial
Ajax learning tutorial
 
Introduccion app engine con python
Introduccion app engine con pythonIntroduccion app engine con python
Introduccion app engine con python
 
Lightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and DesignLightning Talk - Clean Architecture and Design
Lightning Talk - Clean Architecture and Design
 
Mule integration with linkedin
Mule integration with linkedinMule integration with linkedin
Mule integration with linkedin
 
Create Applicationwith IIS 7
Create Applicationwith IIS 7Create Applicationwith IIS 7
Create Applicationwith IIS 7
 
How to implement multiple authentication guards in laravel 8
How to implement multiple authentication guards in laravel 8How to implement multiple authentication guards in laravel 8
How to implement multiple authentication guards in laravel 8
 
Expense personalization
Expense personalizationExpense personalization
Expense personalization
 
How to get AWS student credit
How to get AWS student creditHow to get AWS student credit
How to get AWS student credit
 
EasiShare AWS Setup Guide
EasiShare AWS Setup GuideEasiShare AWS Setup Guide
EasiShare AWS Setup Guide
 
Invoicing app on ribily
Invoicing app on ribilyInvoicing app on ribily
Invoicing app on ribily
 
Filters in Mule Part-3 Message Property Filter
Filters in Mule Part-3 Message Property FilterFilters in Mule Part-3 Message Property Filter
Filters in Mule Part-3 Message Property Filter
 
2310 b 16
2310 b 162310 b 16
2310 b 16
 
Write Tests in End Users’ Lingo
Write Tests in End Users’ LingoWrite Tests in End Users’ Lingo
Write Tests in End Users’ Lingo
 
The A1 by Christian John Felix
The A1 by Christian John FelixThe A1 by Christian John Felix
The A1 by Christian John Felix
 
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-appsJSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
JSChannel 2017 - Service Workers and the Role they Play in modern day web-apps
 
Building mobile applications with Vaadin TouchKit
Building mobile applications with Vaadin TouchKitBuilding mobile applications with Vaadin TouchKit
Building mobile applications with Vaadin TouchKit
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplified
 
Mobile web apps in pure Java
Mobile web apps in pure JavaMobile web apps in pure Java
Mobile web apps in pure Java
 

Similar to Set up email authentication using react native + firebase auth + react navigation

Email authentication using firebase auth + flutter
Email authentication using firebase auth + flutterEmail authentication using firebase auth + flutter
Email authentication using firebase auth + flutterKaty Slemon
 
Full Angular 7 Firebase Authentication System
Full Angular 7 Firebase Authentication SystemFull Angular 7 Firebase Authentication System
Full Angular 7 Firebase Authentication SystemDigamber Singh
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceJen Looper
 
Creating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerCreating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerChandanWebner
 
Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...Katy Slemon
 
End-to-end Mobile App Development (with iOS and Azure Mobile Services)
End-to-end Mobile App Development (with iOS and Azure Mobile Services)End-to-end Mobile App Development (with iOS and Azure Mobile Services)
End-to-end Mobile App Development (with iOS and Azure Mobile Services)Andri Yadi
 
pptindustrial (1).pptx
pptindustrial (1).pptxpptindustrial (1).pptx
pptindustrial (1).pptxquotedcaprio
 
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]Sittiphol Phanvilai
 
Laravel mail example how to send an email using markdown template in laravel 8
Laravel mail example how to send an email using markdown template in laravel 8Laravel mail example how to send an email using markdown template in laravel 8
Laravel mail example how to send an email using markdown template in laravel 8Katy Slemon
 
Android Quiz App – Test Your IQ.pdf
Android Quiz App – Test Your IQ.pdfAndroid Quiz App – Test Your IQ.pdf
Android Quiz App – Test Your IQ.pdfSudhanshiBakre1
 
How React Native Appium and me made each other shine
How React Native Appium and me made each other shineHow React Native Appium and me made each other shine
How React Native Appium and me made each other shineWim Selles
 
How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkKaty Slemon
 
React Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationReact Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationKobkrit Viriyayudhakorn
 
How to build twitter bot using golang from scratch
How to build twitter bot using golang from scratchHow to build twitter bot using golang from scratch
How to build twitter bot using golang from scratchKaty Slemon
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend DevelopersSergio Nakamura
 
Cis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universityCis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universitylhkslkdh89009
 
Intro to Firebase Realtime Database and Authentication
Intro to Firebase Realtime Database and AuthenticationIntro to Firebase Realtime Database and Authentication
Intro to Firebase Realtime Database and Authenticationkristinferrier
 

Similar to Set up email authentication using react native + firebase auth + react navigation (20)

Email authentication using firebase auth + flutter
Email authentication using firebase auth + flutterEmail authentication using firebase auth + flutter
Email authentication using firebase auth + flutter
 
Full Angular 7 Firebase Authentication System
Full Angular 7 Firebase Authentication SystemFull Angular 7 Firebase Authentication System
Full Angular 7 Firebase Authentication System
 
Telerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT ConferenceTelerik AppBuilder Presentation for TelerikNEXT Conference
Telerik AppBuilder Presentation for TelerikNEXT Conference
 
Creating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | WebnerCreating azure logic app for salesforce integration | Webner
Creating azure logic app for salesforce integration | Webner
 
Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...Passport js authentication in nodejs how to implement facebook login feature ...
Passport js authentication in nodejs how to implement facebook login feature ...
 
End-to-end Mobile App Development (with iOS and Azure Mobile Services)
End-to-end Mobile App Development (with iOS and Azure Mobile Services)End-to-end Mobile App Development (with iOS and Azure Mobile Services)
End-to-end Mobile App Development (with iOS and Azure Mobile Services)
 
pptindustrial (1).pptx
pptindustrial (1).pptxpptindustrial (1).pptx
pptindustrial (1).pptx
 
Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]Introduction to Firebase [Google I/O Extended Bangkok 2016]
Introduction to Firebase [Google I/O Extended Bangkok 2016]
 
Cloud Messaging Flutter
Cloud Messaging FlutterCloud Messaging Flutter
Cloud Messaging Flutter
 
Laravel mail example how to send an email using markdown template in laravel 8
Laravel mail example how to send an email using markdown template in laravel 8Laravel mail example how to send an email using markdown template in laravel 8
Laravel mail example how to send an email using markdown template in laravel 8
 
Android Quiz App – Test Your IQ.pdf
Android Quiz App – Test Your IQ.pdfAndroid Quiz App – Test Your IQ.pdf
Android Quiz App – Test Your IQ.pdf
 
How React Native Appium and me made each other shine
How React Native Appium and me made each other shineHow React Native Appium and me made each other shine
How React Native Appium and me made each other shine
 
How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST Framework
 
React Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + AuthenticationReact Native Firebase Realtime Database + Authentication
React Native Firebase Realtime Database + Authentication
 
How to build twitter bot using golang from scratch
How to build twitter bot using golang from scratchHow to build twitter bot using golang from scratch
How to build twitter bot using golang from scratch
 
IRREPORT.pptx
IRREPORT.pptxIRREPORT.pptx
IRREPORT.pptx
 
Firebase
Firebase Firebase
Firebase
 
Introduction to React for Frontend Developers
Introduction to React for Frontend DevelopersIntroduction to React for Frontend Developers
Introduction to React for Frontend Developers
 
Cis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry universityCis407 a ilab 5 web application development devry university
Cis407 a ilab 5 web application development devry university
 
Intro to Firebase Realtime Database and Authentication
Intro to Firebase Realtime Database and AuthenticationIntro to Firebase Realtime Database and Authentication
Intro to Firebase Realtime Database and Authentication
 

More from Katy Slemon

React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdfReact Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdfKaty Slemon
 
Data Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdfData Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdfKaty Slemon
 
How Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdfHow Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdfKaty Slemon
 
What’s New in Flutter 3.pdf
What’s New in Flutter 3.pdfWhat’s New in Flutter 3.pdf
What’s New in Flutter 3.pdfKaty Slemon
 
Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdfWhy Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdfKaty Slemon
 
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdfHow Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdfKaty Slemon
 
How to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdfHow to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdfKaty Slemon
 
How to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdfHow to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdfKaty Slemon
 
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdfSure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdfKaty Slemon
 
How to Develop Slack Bot Using Golang.pdf
How to Develop Slack Bot Using Golang.pdfHow to Develop Slack Bot Using Golang.pdf
How to Develop Slack Bot Using Golang.pdfKaty Slemon
 
IoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdfIoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdfKaty Slemon
 
Understanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfUnderstanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfKaty Slemon
 
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdfThe Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdfKaty Slemon
 
New Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdfNew Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdfKaty Slemon
 
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdfHow to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdfKaty Slemon
 
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdfChoose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdfKaty Slemon
 
Flutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdfFlutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdfKaty Slemon
 
Angular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdfAngular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdfKaty Slemon
 
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdfHow to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdfKaty Slemon
 
Ruby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdfRuby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdfKaty Slemon
 

More from Katy Slemon (20)

React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdfReact Alternatives Frameworks- Lightweight Javascript Libraries.pdf
React Alternatives Frameworks- Lightweight Javascript Libraries.pdf
 
Data Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdfData Science Use Cases in Retail & Healthcare Industries.pdf
Data Science Use Cases in Retail & Healthcare Industries.pdf
 
How Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdfHow Much Does It Cost To Hire Golang Developer.pdf
How Much Does It Cost To Hire Golang Developer.pdf
 
What’s New in Flutter 3.pdf
What’s New in Flutter 3.pdfWhat’s New in Flutter 3.pdf
What’s New in Flutter 3.pdf
 
Why Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdfWhy Use Ruby On Rails.pdf
Why Use Ruby On Rails.pdf
 
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdfHow Much Does It Cost To Hire Full Stack Developer In 2022.pdf
How Much Does It Cost To Hire Full Stack Developer In 2022.pdf
 
How to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdfHow to Implement Middleware Pipeline in VueJS.pdf
How to Implement Middleware Pipeline in VueJS.pdf
 
How to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdfHow to Build Laravel Package Using Composer.pdf
How to Build Laravel Package Using Composer.pdf
 
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdfSure Shot Ways To Improve And Scale Your Node js Performance.pdf
Sure Shot Ways To Improve And Scale Your Node js Performance.pdf
 
How to Develop Slack Bot Using Golang.pdf
How to Develop Slack Bot Using Golang.pdfHow to Develop Slack Bot Using Golang.pdf
How to Develop Slack Bot Using Golang.pdf
 
IoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdfIoT Based Battery Management System in Electric Vehicles.pdf
IoT Based Battery Management System in Electric Vehicles.pdf
 
Understanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdfUnderstanding Flexbox Layout in React Native.pdf
Understanding Flexbox Layout in React Native.pdf
 
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdfThe Ultimate Guide to Laravel Performance Optimization in 2022.pdf
The Ultimate Guide to Laravel Performance Optimization in 2022.pdf
 
New Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdfNew Features in iOS 15 and Swift 5.5.pdf
New Features in iOS 15 and Swift 5.5.pdf
 
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdfHow to Hire & Manage Dedicated Team For Your Next Product Development.pdf
How to Hire & Manage Dedicated Team For Your Next Product Development.pdf
 
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdfChoose the Right Battery Management System for Lithium Ion Batteries.pdf
Choose the Right Battery Management System for Lithium Ion Batteries.pdf
 
Flutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdfFlutter Performance Tuning Best Practices From the Pros.pdf
Flutter Performance Tuning Best Practices From the Pros.pdf
 
Angular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdfAngular Universal How to Build Angular SEO Friendly App.pdf
Angular Universal How to Build Angular SEO Friendly App.pdf
 
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdfHow to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
How to Set Up and Send Mails Using SendGrid in NodeJs App.pdf
 
Ruby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdfRuby On Rails Performance Tuning Guide.pdf
Ruby On Rails Performance Tuning Guide.pdf
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

Set up email authentication using react native + firebase auth + react navigation

  • 1. Set up Email Authentication Using React Native + Firebase Auth + React Navigation www.bacancytechnology.com
  • 2. Build Rect Native App Install required dependencies for Navigation Setting Up Firebase Project Creating Components Table of Contents 1. Overview: React Native Firebase Tutorial 2. What are we building? 3. Firebase Authentication Example: Steps to Implement React Native + Firebase Auth 4. Conclusion
  • 4. This beginners’ guide will help you build a React Native application and integrate it with Firebase. Furthermore, we will set up email authentication with Firebase in React Native. We all have heard how smoothly we can build native applications using React Native. Let’s combine its flexibility with Firebase and get started with this tutorial to implement email authentication and React Navigation using React Native + Firebase auth. https://youtu.be/F66J0_TrjDM
  • 6. We are building a basic React Native application integrated with Firebase Authentication that consists of Sign Up, Login/Logout, Forgot Password, and User Profile. Here is the flow for authenticating a user – whenever the user accesses the app, it will contain the authentication state, and based on that state; the user will have access to the screen or the services of the app. Based on this condition, authenticated and non- authenticated users will have access to different screens accordingly. Here in our demo, we will implement authentication on the Profile screen. It means that only an authenticated user will visit its Profile page; else, it will have only access to Sign Up and Sign In screens. Without further ado, let’s start coding!
  • 7. React Native + Firebase Auth Example: Steps to Implement Firebase Authentication
  • 8. You can visit here – Github Repository and check the code or go through this tutorial. Follow these steps to build a React Native app and implement Firebase Authentication. Create React Native App Initially, we will create a React Native app using- react-native init FirebaseAuth
  • 9. Install required dependencies for Navigation We will require stack navigation for navigating through different screens. npm install react-native-gesture-handler react- native-safe-area-context @react- navigation/native @react-navigation/stack After this, we need to install the React Native Firebase auth library to implement authentication with Firebase in our react app. npm install @react-native-firebase/auth Let’s set-up our Firebase Project.
  • 10. Setting Up Firebase Project First, we need to create a Firebase Project. Visit the official Firebase website and click on Get Started. There you can create your new project. After that, you will be redirected to the Dashboard to use Authentication Service. Here are the images that will help you understand the above process.
  • 11. Click on the authentication on the side menu Select Sign-in Methods In our app, we have to set up authentication for email/password. For that, follow these steps-
  • 12. Select email and passwords Enable Email and Password Authentication by toggling the button Provide the support mail Save I’ve attached an image below for your reference. To configure our app with Firebase, go to the Project Dashboard, Add an app to the project, and follow the proper steps.
  • 13. Now we have all the details related to Firebase configuration. Store these configurations in a file named FirebaseInfo.js
  • 14. import firebase from @react- native-firebase/auth const firebaseInfo={ apiKey:'Your API Key', appId:'Your App Id', messagingSenderId:'Your Sender Id', projectId:'Your Project Id', } // FirebaseInfo.js And then initialize the app using: firebase.initializeApp(firebaseinfo)
  • 15. Creating Components Let’s get started with creating components for our application. As it’s basic authentication, it will consist of the following components- SignUp, Login/Logout, ResetPassword, User Details of the currently logged-in user, and a Navigator to move between screens.
  • 16. After entering the required details, whenever a user clicks on the SignUp button, it will validate and check if there is an error related to the email registration. Here is the logic for implementing the Sign Up process. Sign Up const OnSignUp= async(email,password)=>{ Keyboard.dismiss() if(!email) { Alert.alert("Email can't be empty"); } else if(!EmailRegex.test(email)) { Alert.alert("Email is not in the right format") } else if(!password && password.trim() && password.length<5) {
  • 17. Alert.alert("Password is too weak and required min 6 characters") } else{ try{ const Email=await firebase.auth().createUserWithEmailAndPas sword(email,password) Email.user.updateProfile({displayName:use rname}) Email.user.reload() setusername("") setemail("") setpassword("") props.navigation.navigate('Login') } catch(error) {
  • 18. console.log("error", error.message, error.code) switch (error.code) { case "auth/weak-password": Alert.alert("Password is invalid,requires min 6 char") break; case "auth/email-already-in-use": Alert.alert("Email is already registered") break; default: Alert.alert("Error") } } } }
  • 19. Log In Similarly, the Login screen will verify if the user is authenticated or not. It can be verified with the given parameters (email, password): const AuthUser = await firebase.auth().signInWithEmailAndPa ssword(email, password) Log Out For Log Out, we will revoke the access from the user and let him sign out from the app with this: await firebase.auth().signOut()
  • 20. Forget Password If you don't remember your password, Forget Password screen lets you recover your password using your email-id where Firebase will share a link to reset your password using: await firebase.auth().sendPasswordResetEm ail(email)
  • 21. User Profile The user profile will display user details (of the logged-in user) such as email-id and user name entered a48t the time of Sign Up: var EmailId=firebase.auth().currentUser.email; var User=firebase.auth().currentUser.displayNa me;
  • 22. Conclusion This was about setting up email/ password authentication and React Navigation using React Native + Firebase Auth. I hope the purpose for landing on this tutorial has been fulfilled as you've expected. If you are looking to develop one-of-a-kind React Native application, then get in touch with us to hire React Native developer from us to leverage to leverage our top-notch React Native app development services.