0
我正在嘗試一些Firebase示例,特別是如何從Java(標準JDK,不是Android)認證用戶。爲什麼CredentialStore警告在Java中使用Firebase用戶身份驗證?
每次我運行代碼,我從(我相信)的火力地堡API這些警告:
Sun Jun 28 14:29:58 BST 2015 [WARN] CredentialStore: Using no-op credential store. Not persisting credentials! If you want to persist authentication, please use a custom implementation of CredentialStore.
authenticated ok!
這是什麼指什麼?當它暗指持久性時,是指應用程序會話期間的持久性,還是應用程序的連續運行之間的持久性?我如何解決此警告?
這裏是代碼 - 這是基於對火力地堡導向的例子(注意,帳戶的細節一直被掩蓋):
package firebase_reader;
import com.firebase.client.AuthData;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import java.util.logging.Level;
import java.util.logging.Logger;
public class main
{
public static void main(String[] args)
{
final Firebase fbref = new Firebase("https://XXX.firebaseio.com/");
Firebase.AuthResultHandler authResultHandler = new Firebase.AuthResultHandler()
{
@Override
public void onAuthenticated(AuthData authData)
{
System.out.print("authenticated ok!\n");;
}
@Override
public void onAuthenticationError(FirebaseError firebaseError)
{
System.out.print("auth failed:" + firebaseError);
}
};
fbref.authWithPassword("YYY", "ZZZ", authResultHandler);
try
{
while (true) { Thread.sleep(10000); }
} catch (InterruptedException ex)
{
Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}