Issue
I'm trying to create a web app using java and spring-boot as the backend. I want to use the createUserWithEmailAndPassword method of FirebaseAuth in order to create a new user in my firebase database.
This is init of the FirebaseAuth object:
private final FirebaseAuth mAuth = FirebaseAuth.getInstance();
I'm trying to access createUserWithEmailAndPassword from the mAuth object but it does not recognize the method, it can only find:
mAuth.createUser(CreateRequest request);
or
mAuth.createUserAsync(CreateRequest request);
The project is build with gradle:
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'com.google.firebase:firebase-admin:9.0.0'
}
what am I missing?
Solution
The createUserWithEmailAndPassword
method only exists in the client-side SDKs of Firebase, such as those for use in Web and Android apps.
You are using the Admin SDK for Java, which is made for using in server-side code such as yours. The Admin SDKs do not have a createUserWithEmailAndPassword
, but you can create a user by calling createUser
as shown in the link.
Answered By - Frank van Puffelen
Answer Checked By - Katrina (JavaFixing Volunteer)