-
Notifications
You must be signed in to change notification settings - Fork 286
FR: add ability to communicate with Auth Emulator #493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Any timelines on this one? Any way we could help getting this through the door? |
@dv-bv Sure! We welcome Pull Requests that add support for the environment variable to the Java Admin SDK. Just keep in mind that we're still having some important discussions on |
Hi! I start this PR: #510 |
Hi! When will the new version be available with this feature? |
@yuchenshi, are there any updates on those discussions about |
@dmitri-gb As you've observed, we've reached some conclusions regarding While we're unable to provide ETAs, please rest assured we're building on top of @7agustibm's amazing work for network communications and we'll release once we have ID token support as well. |
A snippet for connecting to auth emulator and import user https://firebase.google.com/docs/auth/admin/import-users#java package foo;
import java.util.ArrayList;
import java.util.List;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthException;
import com.google.firebase.auth.ImportUserRecord;
import com.google.firebase.auth.UserImportOptions;
import com.google.firebase.auth.hash.HmacSha256;
import com.google.firebase.internal.EmulatorCredentials;
import com.google.firebase.internal.FirebaseProcessEnvironment;
import org.junit.jupiter.api.Test;
public class ImportUserTest {
@Test
public void testImportLocal() throws FirebaseAuthException {
// Create FirestoreAuth connecting to local emulator
// https://github.com/firebase/firebase-admin-java/issues/493
FirebaseProcessEnvironment.setenv("FIREBASE_AUTH_EMULATOR_HOST", "localhost:9099");
FirebaseOptions options = FirebaseOptions.builder()
.setProjectId("foo-abcd")
.setCredentials(new EmulatorCredentials())
.build();
FirebaseApp.initializeApp(options);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
List<ImportUserRecord> users = new ArrayList<>();
users.add(ImportUserRecord.builder()
.setUid("uid1")
.setEmail("[email protected]")
.setPasswordHash("passwordHash1".getBytes())
.setPasswordSalt("salt1".getBytes())
.build());
UserImportOptions userImportOptions = UserImportOptions.withHash(
HmacSha256.builder()
.setKey("secretKey".getBytes())
.build());
firebaseAuth.importUsers(users, userImportOptions);
}
} |
Uh oh!
There was an error while loading. Please reload this page.
On the emulator documentation it states the the Node SDK can connect to the Firebase Authentication Emulator by using an environment variable - https://firebase.google.com/docs/emulator-suite/connect_auth
It would be great if this could also be supported in the Java SDK
The text was updated successfully, but these errors were encountered: