FirebaseAuthEx - Extends FirebaseAuth functionality

DonManfred

Expert
Licensed User
Longtime User
i was able to add a solution for the login (sucess or not) but the createnew user will raise an exception if there is already such a user... I can´t find a fix to get the error message
 

alimanam3386

Active Member
Licensed User
Longtime User
i was able to add a solution for the login (sucess or not) but the createnew user will raise an exception if there is already such a user... I can´t find a fix to get the error message

Ok thank you man , and when you release updated lib ?
 

DonManfred

Expert
Licensed User
Longtime User
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
btnSignInwithEmailandPassword_Click()
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
signInWithEmail:eek:nComplete: false
TaskIncomplete
Result received
onFailure: Exception raised
com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The password is invalid or the user does not have a password.
anon_SignedIn(false,Login Unsuccessful)
anon_SignedIn(false,com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The password is invalid or the user does not have a password.)

I´m using v1.14

B4X:
Sub btnSignInwithEmailandPassword_Click
    Log($"btnSignInwithEmailandPassword_Click()"$)
    'anon.createUserWithEmailAndPassword("[email protected]","kallekalle")
    anon.SignInWithEmailAndPassword("email","wrongpassword")
End Sub

Sub anon_SignedIn (success As Boolean, User As FirebaseAuthUser, info As String)
    Log($"anon_SignedIn(${success},${info})"$)
    If success Then
        If User = Null Then
            Log("nulluser SignedIn: ")
        Else   
            Log("SignedIn: " & User.Uid)
            Log("User: " & User.DisplayName)
            Log("eMail: " & User.Email)
            Log("Anonymously: " & User.Anonymous)
            Log("Email  verified: " & User.EmailVerified)
            If User.EmailVerified = False Then
                'Log("Email verification request")
                'User.sendEmailVerification
            End If
        End If
        Log("SignedIn: " & User.DisplayName)
[...]
End sub
 

alimanam3386

Active Member
Licensed User
Longtime User
you should not try to catch it... the workaround will not work in try catch block i guess

But as you can see I didn't use try catch block code in "signedIn" event , And also the " UserCreated " event still not work (even if you define the object in activity )
 

Gentry

Member
Licensed User
Longtime User
I am trying to access the providerData list elements in order to get the google ID from the google login provider, however the providerData List returns object references instead of a list or map of actual data values like this:

B4X:
com.google.android.gms.internal.zzafs@e1e82ab
com.google.android.gms.internal.zzafs@a0fed08

How can I access the actual data values from these object references?

Thanks for the extension and your help!

Gentry
 

roberto67

New Member
Licensed User
Longtime User
Worked. Thank you.

New effect while trying to "SignUp" a new eMail user:
B4X:
Dim authx As FirebaseAuthEx

'...
authx.Initialize("authx")
'...

Sub button_sign_up_Click
    authx.createUserWithEmailAndPassword("[email protected]", "foo123")
End Sub

Sub authx_UserCreated(User As  FirebaseAuthUser)  ' <--tried also "FirebaseUser", but that type misses: .Anonymous, .EmailVerified, .ProviderData, .ProviderId, .Providers
  '... throws error message (see below)
End Sub

B4X:
java.lang.Exception: Sub authx_usercreated signature does not match expected signature.
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:171)
   at anywheresoftware.b4a.BA$2.run(BA.java:328)
   at android.os.Handler.handleCallback(Handler.java:751)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:154)
   at android.app.ActivityThread.main(ActivityThread.java:6077)
   at java.lang.reflect.Method.invoke(Native Method)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
hi,
Method: createUserWithEmailAndPassword (email As String, password As String)works perfectly,
but when I try to register a user with an existing email, i get an error message that I do not know how to handle:
createUserWithEmail: onComplete: false
com.google.android.gms.tasks.RuntimeExecutionException: com.google.firebase.auth.FirebaseAuthUserCollisionException: The email address is already in use by another account.
Then the program stop and i do not know what to do.
Can you help me?
 

roberto67

New Member
Licensed User
Longtime User
I´m using v1.14

B4X:
Sub btnSignInwithEmailandPassword_Click
    Log($"btnSignInwithEmailandPassword_Click()"$)
    'anon.createUserWithEmailAndPassword("[email protected]","kallekalle")
    anon.SignInWithEmailAndPassword("email","wrongpassword")
End Sub

Sub anon_SignedIn (success As Boolean, User As FirebaseAuthUser, info As String)
    Log($"anon_SignedIn(${success},${info})"$)
    If success Then
        If User = Null Then
            Log("nulluser SignedIn: ")
        Else  
            Log("SignedIn: " & User.Uid)
            Log("User: " & User.DisplayName)
            Log("eMail: " & User.Email)
            Log("Anonymously: " & User.Anonymous)
            Log("Email  verified: " & User.EmailVerified)
            If User.EmailVerified = False Then
                'Log("Email verification request")
                'User.sendEmailVerification
            End If
        End If
        Log("SignedIn: " & User.DisplayName)
[...]
End sub
hi,
method, "createUserWithEmailAndPassword" works perfectly,
but when I try to register a user with the same email i get an error message that I do not know how to handle:

"createUserWithEmail: onComplete: false
com.google.android.gms.tasks.RuntimeExecutionException: com.google.firebase.auth.FirebaseAuthUserCollisionException: The email address is already in use by another account."

I do not know what to do. Can you help me?
 

roberto67

New Member
Licensed User
Longtime User
Thank you Manfred,
but the problem has not been resolved. If the user mail does not exist, or if the password is wrong, I can see the mistakes in the:
"Sub anon_SignedIn (success As Boolean, User As FirebaseAuthUser, info As String)" properly,
but if I try to create a new user with a mail already exists, the SUB_Signedin does not detect this error and the program stops working.
 

Robert_Rm

Member
Licensed User
And Please check the " AuthEx_UserCreated " EVENT . when you create new user by " createUserWithEmailAndPassword " Function , The Event for UserCreated NOT work correctly .

Cheers Man :)
Hi,
my program has a similar problem. When i try to create new user with method "createUserWithemailAndPassword", if the email has already been used previously, the program stop. Can you help me?
 
Top