How can I create a document user in firebase when I first authenticate or multiple times ???
Example: I choose to authenticate by google, Twitter .... by account abc@gmail.com ... and I want to save to collection "user" with document = User UId (google account).
With the certificate authentication method I don't know how to get the Google User User UID until it's added to the Authentication List.
signInWithGoogleAsync = async () => {
try {
const { type, accessToken } = await Google.logInAsync({
iosClientId: '1058889369323-kh44jtru0ar24qu24ebv1bu0ebrgvokd.apps.googleusercontent.com',
scopes: ['profile', 'email'],
});
if (type === 'success') {
this.setState({ spinner: true });
const credential = firebase.auth.GoogleAuthProvider.credential(null, accessToken);
firebase.auth().signInWithCredential(credential).catch(error => {console.log(error);});
///I know how to do this, authenticate 1 user and put it in the Authentication list when authenticating successfully the first time
} else {
return { cancelled: true };
}
} catch (e) {
return { error: true };
}
}