java - Endless failures of Firebase authentication -


my app fails on authentication new users while registering. application connected google firebase , nothing seems done wrong it. code seems alright, displays no errors , checked 10000000 times. needed imported. when try register new user error appears says: "an internal error has occured. [access not configured. google identity toolkit api has not been used in project (here 12-digit project number) before or disabled. enable visiting console.developers.google.com/apis/api/… project number) retry. if enabled api recently, wait few minutes action propagate our systems , retry.] set authentication yesterday don't know do...

public class registeruseractivity extends appcompatactivity {     //declare fields     edittext useremailcreateedittext, userpasswordcreateedittext;     linearlayout createaccountbtn;     //firebase authentication id     firebaseauth mauth;     firebaseauth.authstatelistener mauthlistener;     //progress dialog     progressdialog mprogressdialog;     @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_register_user);         //assign id's         useremailcreateedittext = ( edittext ) findviewbyid(r.id.emailregisteredittext);         userpasswordcreateedittext = (edittext) findviewbyid(r.id.passwordregisteredittext);         createaccountbtn = ( linearlayout) findviewbyid(r.id.createaccountsubmitbtn);         //progress dialog instance         mprogressdialog = new progressdialog(this);         //firebase instance         mauth = firebaseauth.getinstance();         mauthlistener = new firebaseauth.authstatelistener() {             @override             public void onauthstatechanged(@nonnull firebaseauth firebaseauth) {                 //check user                 firebaseuser user = firebaseauth.getcurrentuser();                 if( user != null )                 {                     intent movetohome = new intent(registeruseractivity.this, home.class);                     movetohome.addflags(intent.flag_activity_clear_top);                     startactivity( movetohome );                 }             }         };         mauth.addauthstatelistener(mauthlistener);         //create on click listener         createaccountbtn.setonclicklistener(new view.onclicklistener() {             @override             public void onclick(view v) {                 mprogressdialog.settitle("create account");                 mprogressdialog.setmessage("wait while account being created..");                 mprogressdialog.show();                 createuseraccount();             }         });     }     @override     protected void onstart() {         super.onstart();         mauth.addauthstatelistener(mauthlistener);     }     @override     protected void onstop() {         super.onstop();         mauth.removeauthstatelistener(mauthlistener);     }     //logic creating user account     private void createuseraccount() {         string emailuser, passuser;         emailuser = useremailcreateedittext.gettext().tostring().trim();         passuser = userpasswordcreateedittext.gettext().tostring().trim();         if( !textutils.isempty(emailuser) && !textutils.isempty(passuser))         {             mauth.createuserwithemailandpassword(emailuser, passuser).addoncompletelistener(new oncompletelistener<authresult>() {                 @override                 public void oncomplete(@nonnull task<authresult> task) {                     if( task.issuccessful() )                     {                         toast.maketext(registeruseractivity.this, "account created success", toast.length_long).show();                         mprogressdialog.dismiss();                         intent movetohome = new intent(registeruseractivity.this, home.class);                         movetohome.addflags(intent.flag_activity_clear_top);                         startactivity( movetohome );                     }else                     {                         toast.maketext(registeruseractivity.this, task.getexception().getmessage(), toast.length_long).show();                         mprogressdialog.dismiss();                         task.getexception().getmessage();                     }                 }             });         }     } } 

the project_id in android app's google-services.json file should same firebase console project enabled google sign in authentication. try re-download google-services.json firebase console, , re-build android app.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -