[go: up one dir, main page]

0% found this document useful (0 votes)
9 views2 pages

Firebase Create Authentication Account

Uploaded by

krose246813579
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Firebase Create Authentication Account

Uploaded by

krose246813579
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Firebase create authentication new account

createUserWithEmailAndPassword(auth,email,password)
.then((userCredential)=>{
//already sign in

const user = userCredential.user;

//...

}).catch((error)=>{
const errorCode = error.code;
const errorMessage = error.message;

//...
})

-----------------------------------------------------------------------------------
-------
Firebase create authentication email account

signInWithEmailAndPassword(auth,email,password)
.then((userCredential)=>{
//already sign in

const user = userCredential.user;

//...

}).catch((error)=>{
const errorCode = error.code;
const errorMessage = error.message;

//...
})

-----------------------------------------------------------------------------------
-------
Firebase create authentication third party account

const provider = new GoogleAuthProvider; //or facebook,twitter...

//open that window

signInWithPopup(auth,provider)
.then((result)=>{
//already sign in

const user = result.user;

//...

}).catch((error)=>{
const errorCode = error.code;
const errorMessage = error.message;
//...
})

-----------------------------------------------------------------------------------
-------
Check user Sign?

//when createUserWithEmailAndPassword or signInWithEmailAndPassword success

onAuthStateChanged(auth,(user)=>{
if(user){
//already sign in
const name = user.displayName;
const email = user.email;
const uid = user.uid;
}else
{
//

}
-----------------------------------------------------------------------------------
-

You might also like