Firebase身份validation限制

我是Firebase的新手,所以任何见解都值得赞赏。 我正在编写Java服务器端测试代码。 我从数据库中抓取了几个用户,并尝试将数据迁移到Firebase中经过用户身份validation的节点中。 我的代码从数据库中选择一些用户并为每个用户旋转一个新线程。

第一个线程成功连接和validation。 随后的同步身份validation尝试失败,并显示以下错误消息。 每个线程都有自己的Firebase引用对象实例。 同时登录的数量是否有限制,可能来自同一个IP地址? 尚未在文档中找到任何内容。

如果我将代码更改为在单个线程中运行并逐个登录并注销每个用户,那么我不会收到错误。

任何见解都非常赞赏。

Message: -5 Message: Due to another authentication attempt, this authentication attempt was aborted before it could complete. Firebase ref = new Firebase("https://.firebaseio.com/"); ref.authWithPassword(mEmail, mPassword, new Firebase.AuthResultHandler() { @Override public void onAuthenticated(AuthData authData) { System.out.println("Successfully authenticated: " + mEmail); user.setUID(authData.getUid()); user.setCurrentUserRef(ref); done.set(true); } @Override public void onAuthenticationError(FirebaseError firebaseError) { System.out.println("Error during authentication: " + mEmail); System.out.println("Error during authentication: " + ref.toString()); System.out.println("Message: " + firebaseError.getCode()); System.out.println("Message: " + firebaseError.getDetails()); System.out.println("Message: " + firebaseError.getMessage()); done.set(true); }}); waitForCompletion(this.getClass().getName()); 

如果由于安全规则而作为不同用户进行身份validation,则使用服务器令牌是更好的解决方案。

Firebase连接在任何给定时间最多只能有一个用户通过身份validation。 但是,在Firebase Java库中,有一个未记录(并且未得到官方支持)的解决方法来创建多个独立连接。 在com.firebase.client包中的类中,您可以运行以下代码

 // important this code needs to be in the package com.firebase.client Config config1 = new Config(); Config config2 = new Config(); Firebase ref1 = new Firebase("https://.firebaseio.com", config1); Firebase ref2 = new Firebase("https://.firebaseio.com", config2); // ref1 and ref2 will now have independent connections, listeners and authentication states 

请注意,这些也将打开与服务器的独立连接。