Anushka Praveen
Anushka Praveen

Reputation: 139

Get firebase id

I use firebase authentication. I need to get the firebase id when using the signInWithEmailAndPassword function. I try to get firebase id using result. But I coudn't.

firebase Authentication function

const signInresponse = await firebaseAuth.signInWithEmailAndPassword(email, password).then((res)=>{
    console.log(res);
  })
  history.push('/User/Directory');
} catch (e) {
  console.error(e);
} 

Upvotes: 1

Views: 175

Answers (1)

Joseph Utulu
Joseph Utulu

Reputation: 246

The user id is inside the user object of the result.

const signInresponse = await firebaseAuth.signInWithEmailAndPassword(email, password).then((res)=>{
  console.log(res.user.uid);
})
  history.push('/User/Directory');
} catch (e) {
  console.error(e);
} 

Upvotes: 1

Related Questions