week12
week12
Development
BY
AATIQA BINT E GHAZALI
• FIREBASE AUTHENTICATION
Creating account on firebase
• Login to www.firebase.com
• Enter into console
• Create a new project
• For now, disable google analytics
• Choose a name
• You are done
Integrate firebase into your app
• Choose web for now
• Register your app for now
Register app
• Register your app
• install firebase in your app
Configuration/firebase sdk
• Copy the configuration from website and paste it in the project
• Click next
• Click complete
Firebase authentication
• Go to firebase authentication and click on get started
• For this usecase select authentication using email and password
• Enable it
• Click save
Configurations in code
• Import necessary libraries
• Get the text entered into input fields using value and onChangeText
fields
Debugging
• Test side by side to get what you are coding.
• On button click get the text that users entered into text fields
Important firebase auth functions
• Its important to import these functions from firebase to get
authentication done
createUserWithEmailAndPassword
• createUserWithEmailAndPassword: used to create a new user in
firebase.
• It will take 3 arguments (auth , email , password)
• Where auth is the variable imported from firebase file initially
imported from getAuth
• Email and password are user entered records
• It will alert an error on duplicate entry
• We will call this function inside the function attached with Register
button
signInWithEmailAndPassword
• Use to sign-in a user with already registered
• Alert an error on wrong entry
• It will take 3 arguments (auth , email , password)
• Where auth is the variable imported from firebase file initially
imported from getAuth
• Email and password are user entered records
• We will call this function inside the function attached with Login
button
What is user??
• In Firebase Authentication, the user object represents the currently
authenticated user.
• This object contains various properties and methods that give you
information about the user’s identity and allow you to manage their
authentication details.
• The user object is returned by Firebase methods such as
onAuthStateChanged, signInWithEmailAndPassword, and
createUserWithEmailAndPassword
onAuthStateChanged