How to make Firebase authentication work completely without Identity Toolkit API

£可爱£侵袭症+ 提交于 2020-01-04 05:25:11

问题


I'm trying to create email password account using Firebase in Android project. I have added Firebase using the Android Studio's Firebase Assistant.

The create user code is as follows.

mAuth.createUserWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                        if (task.isSuccessful()) {
                            FirebaseUser user = mAuth.getCurrentUser();
                            onLoginUpdateUI(user);
                        } else {
                            System.err.println("message:\n" + task.getException().getMessage());
                            onLoginUpdateUI(null);
                        }
                }
            });

I entered valid email and password (more than 6 characters) I got the following error:

com.google.firebase.FirebaseException: An internal error has occurred. [ Identity Toolkit API has not been used in project before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/identitytoolkit.googleapis.com/overview?project= then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry. ]

I have enabled email/password sign-in method in https://console.firebase.google.com.

Then I went to https://console.developers.google.com and enabled Identity Toolkit API.

Then the authentication worked correctly.

BUT I have seen

The newest version of Google Identity Toolkit has been released as Firebase Authentication. Going forward, feature work on Identity Toolkit will be frozen and all new feature development will be done on Firebase Authentication. We encourage Identity Toolkit developers to move to Firebase Authentication as soon as is practical for their applications; however, Identity Toolkit continues to work and will not be deprecated without a further announcement.

So My question is, if they are going to deprecate Identity Toolkit API, how to make Firebase email/password authentication completely without Identity Toolkit API?


回答1:


I had to Create a new Firebase project manually (without using the Firebase assistance in Android studio) in https://console.firebase.google.com and replace google-services.json with that of the new one. And it worked.



来源:https://stackoverflow.com/questions/51133843/how-to-make-firebase-authentication-work-completely-without-identity-toolkit-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!