...to extend the functionality of FirebaseAuth...
' 1. Make sure to have YOUR package name [Ctl+B] in your "Firebase Project settings" https://console.firebase.google.com/project
' 2. Make sure to have YOUR "google-services.json" file in your B4A project folder
' 3. Make sure to have YOUR strFirebaseProjectId in the "Starter" module (replace "myid-abc1111" with yout project-id)
' 4. While using this project always have this two windows open: a) Logs, b) Firebase console/Database/DATA
FirebaseAuthEx
Events:
- SignedIn (User As FirebaseUser)
- UserCreated (User As FirebaseUser)
@DonManfred I reloaded the latest FirebaseAuthEx library and the .CurrentUser.EmailVerified method now appears to function correctly.Is there an problem?I didn´t try it as yet
Maybe i missed the post where someone posted the problem?
...Shouldn't it be (User as FirebaseAuthUser).. ?
I didn't encounter this error when I tested FirebaseAuthEx but I had both FirebaseAuth and FireBaseAuthEx loaded and used FireBaseAuth's SignedIn event. Didn't use FireBaseAuthEx's SignedIn event. That would explain why I didn't get any errors.
you can just change your subs signature to use FirebaseAuthUser instead of FirebaseUser then it should workdid you had a chance to work on the lib?
Worked. Thank you....just change your subs signature...
Dim authx As FirebaseAuthEx
'...
authx.Initialize("authx")
'...
Sub button_sign_up_Click
authx.createUserWithEmailAndPassword("myemail@providerxy.com", "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
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)
Works! Thank you.
See the docu. You are responsible to check the requirements and if the user does not exists. And only then create a new user.Would it be possible to get an errorcode for that in yyy_UserCreated?
Added the download to post #1Works! Thank you.
Starter.AuthEx.SignInWithEmailAndPassword(txtEmail.Text , txtPassword.Text)
Sub AuthEx_SignedIn(User As FirebaseAuthUser)
If User.IsInitialized Then
ToastMessageShow("OK Welcome !" , False)
Else
' This line of code will not run ! why ?
ToastMessageShow("Email or password invalid !" , False)
End If
End Sub
' And also this event never run ( when we use createUserWithEmailAndPassword function )
Sub AuthEx_UserCreated(User As FirebaseAuthUser)
ToastMessageShow("New User Registered in db successfuly" , False)
End Sub
The given user does contain all infos needed. Check the Properties.But when the login action was not successful how can we know that was not successful ????
@ShortName("FirebaseAuthUser")
public static class FirebaseAuthUserWrapper extends AbsObjectWrapper<FirebaseUser> {
public boolean getAnonymous() {
return getObject().isAnonymous();
}
public void updateEmail(String email) {
getObject().updateEmail(email);
}
public void delete() {
getObject().delete();
}
public void updatePassword(String password) {
getObject().updatePassword(password);
}
public void sendEmailVerification() {
getObject().sendEmailVerification();
}
public boolean getEmailVerified() {
return getObject().isEmailVerified();
}
public String getEmail() {
return getObject().getEmail();
}
public String getDisplayName() {
return getObject().getDisplayName();
}
public String getUid() {
return getObject().getUid();
}
public String getProviderId() {
return getObject().getProviderId();
}
public List<String> getProviders() {
return getObject().getProviders();
}
public List<? extends UserInfo> getProviderData() {
return getObject().getProviderData();
}
public String getPhotoUrl() {
return getObject().getPhotoUrl() == null ? "" : getObject().getPhotoUrl().toString();
}
}
The given user does contain all infos needed. Check the Properties.
Starter.AuthEx.SignInWithEmailAndPassword(txtEmail.Text , txtPassword.Text)
Sub AuthEx_SignedIn(User As FirebaseAuthUser, Success as Boolean)
If Success Then
' do somethings
Else
' Here we can do some things ..... ex: Show a alert box or notify
End If
End Sub
ah, ok. Now i understand.
Hmmm... Did you see something like "signInWithEmail:failed" in your log when trying to use wrong credentials?
I guess i´ll add a fallback event in case of a unsuccessfull login now as i´m reviewing the code
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?