无法使用Android在Firebase中创建用户

时间:2016-08-26 03:25:51

标签: android firebase firebase-authentication

我在firebase中创建了一个用户,但每次调用createUser时都会显示错误消息 - Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs available from firebase.google.com/docs/auth/

Firebase ref = new Firebase("https://<APP-NAME>.firebaseio.com");
        ref.createUser("test@abc.com", "123", new Firebase.ValueResultHandler<Map<String, Object>>() {
            @Override
            public void onSuccess(Map<String, Object> result) {
                Log.d(TAG, "create successful " + result.get("uid"));
            }

            @Override
            public void onError(FirebaseError firebaseError) {
                Log.d(TAG, "create error " + firebaseError.getMessage());
            }
        });

这是我使用的依赖项:

compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.google.firebase:firebase-auth:9.4.0'
compile 'com.google.firebase:firebase-database:9.4.0'

我已将Google Play服务和Google存储库更新到最新版本。

1 个答案:

答案 0 :(得分:1)

错误消息非常明确:由于您的项目是在firebase.google.com上创建的,因此它只能使用https://firebase.google.com/docs/auth/中的身份验证SDK。查看documentation to create a email+password user under there

另见:How to solve the error "Projects created at console.firebase.google.com must use the new Firebase Authentication SDKs"