Firebase身份验证服务器错误

时间:2017-03-24 19:54:46

标签: java firebase firebase-authentication

我收到以下错误:

For a custom firebase host you must first set your authentication 
server before using authentication features!

我的代码:

public void initialize() throws IOException {

    FileInputStream serviceAccount = new FileInputStream("/Users/ryan/dev/uandmemelogin/src/main/java/rgross/kmccann/firebase.json");

    FirebaseOptions options = new FirebaseOptions.Builder()
            .setCredential(FirebaseCredentials.fromCertificate(serviceAccount))
            .setDatabaseUrl("https://uandmeme-57321.firebaseio.com/")

            .build();

    FirebaseApp.initializeApp(options);

    firebase.createUser("rgross", "ser", new Firebase.ValueResultHandler<Map<String, Object>>() {
        @Override
        public void onSuccess(Map<String, Object> stringObjectMap) {
            System.out.println("Worked");
        }

        @Override
        public void onError(FirebaseError firebaseError) {
            System.out.println("Failed");
        }
    });

我做错了什么?我已经按照文档进行了操作,但我仍在苦苦挣扎。

1 个答案:

答案 0 :(得分:0)

初始化Firebase连接时,很可能使用了错误的网址。

请确保它采用以下格式:

ObjectiveC

Firebase *myRootRef = [[Firebase alloc] initWithUrl:@"https://<YOUR-FIREBASE-APP>.firebaseio.com"];