I want to make a register function in firebase I'm new to it so I would appreciate any help. I found the firebase docs page and it says I can wether use it in the frontend or in the backend. In both ways I can use a function like this one:
import { getAuth, createUserWithEmailAndPassword } from "firebase/auth";
const auth = getAuth();
createUserWithEmailAndPassword(auth, email, password)
.then((userCredential) => {
// Signed in
const user = userCredential.user;
// ...
})
But this method only allows me to create it with email and password.
I want to be able to insert more values like name, phone, company, etc.
In the docs says I can use the admin SDK like so:
getAuth()
.createUser({
email: 'user@example.com',
emailVerified: false,
phoneNumber: '+11234567890',
password: 'secretPassword',
displayName: 'John Doe',
photoURL: 'http://www.example.com/12345678/photo.png',
disabled: false,
})
.then((userRecord) => {
But I don't know where to get the getAuth() method from.
I would appreciate your help a lot 😁