B4A Library Firebase phone number authentication

Here is my second lib, a wrap to integrate firebase auth phone number authentication.
It is working nicely on my app.
for reference visit: Authenticate with Firebase on Android using a Phone Number

FirebaseAuthPhone

Version: 1.9


Events:

  • phoneverification (success As Boolean, info As String)
  • phonesignedin (success As Boolean, User As FirebaseAuthPhoneUser, info As String)
  • oncodesent (success As Boolean, verificationid As String)
  • gettoken (success As Boolean, token As String, info As String)
Methods:
  • Initialize (eventName As String)
  • startPhoneNumberVerification (phoneNumber As String)
  • verifyPhoneNumberWithCode (verificationId As String, code As String)
  • currentToken ()
  • SignOut

Properties:
  • CurrentUser As FirebaseAuthPhoneUserWrapper [read only]


FirebaseAuthPhoneUser

Properties:

  • Anonymous As Boolean [read only]
  • IsInitialized As Boolean [read only]
  • ProviderData As List [read only]
  • ProviderId As String [read only]
  • Providers As List [read only]
  • Uid As String [read only]

Version1.8 released. It has been compiled with latest Firebase SDK and works with B4A 12.0+
Version1.9 released.Fixes a bug that caused application to crash when a wrong or expired code was entered.
 

Attachments

  • FirebaseAuthPhone_V1.9.zip
    13.1 KB · Views: 58
  • AuthSample.zip
    182.2 KB · Views: 56
Last edited:

scsjc

Well-Known Member
Licensed User
Longtime User
Hello scsjc,

Have you tested it with the sample project ? , authphone_phoneverification is triggered correctly for me..
yes, i think the problem i haved in my project.

the captcha window, autoclose before select objects... ( anything from my app triger and close this window captcha )
is possible dissable windows captcha ?
 

Enrico Fuoti

Member
Licensed User
Longtime User
yes, i think the problem i haved in my project.

the captcha window, autoclose before select objects... ( anything from my app triger and close this window captcha )
is possible dissable windows captcha ?
I don't get the captcha request on my project. It may be related to a missing SHA-2 key
Try to go to your firebase project console and check SHA2 key. then re-download your google-services.json
 

scsjc

Well-Known Member
Licensed User
Longtime User
I don't get the captcha request on my project. It may be related to a missing SHA-2 key
Try to go to your firebase project console and check SHA2 key. then re-download your google-services.json

i have this configuration on firebase, not see SHA2, only see SHA-1 and SHA-256

1668163821339.png



The captcha asks me when it fires authphone_oncodesent .... with .... success=true and verificationid exists
the captcha that appears to me is to verify that a human is on the screen
 

scsjc

Well-Known Member
Licensed User
Longtime User
i have this configuration on firebase, not see SHA2, only see SHA-1 and SHA-256

View attachment 135893


The captcha asks me when it fires authphone_oncodesent .... with .... success=true and verificationid exists
the captcha that appears to me is to verify that a human is on the screen

yes i have a value in SHA-256
 
all the library versions before the 1.8 version do not work with b4a 12.
the 1.8 version has 2 problems 1st if we put the manual code wrong it is crashing, 2nd it is asking for a captcha every time we need to do verification.

i hope that you can find a solution for this issue

com.google.android.gms.tasks.RuntimeExecutionException: com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The sms verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.

at com.google.android.gms.tasks.zzu.getResult(com.google.android.gms:p[email protected]@17.2.0:15)

at anywheresoftware.b4a.FirebaseAuthPhone.FirebaseAuthPhoneWrapper$3.onComplete(FirebaseAuthPhoneWrapper.java:338)
 

Enrico Fuoti

Member
Licensed User
Longtime User
all the library versions before the 1.8 version do not work with b4a 12.
the 1.8 version has 2 problems 1st if we put the manual code wrong it is crashing, 2nd it is asking for a captcha every time we need to do verification.

i hope that you can find a solution for this issue
Hello Madrigal,
The 1.8 version is compiled with latest firebase sdk. I tested with sample project and worked fine. I did not get the errors you mentioned.
download the apk in the following link and test it. let me know if it works on your device,
It is compiled with b4a 12.
https://www.dropbox.com/s/bgn8isn5eyr9d0c/authsample.zip?dl=1
If it works, the problem may be in firebase sdk. It looks like there is an issue with it that affects apps that are published on playstore and have a long name.
 
Hello Madrigal,
The 1.8 version is compiled with latest firebase sdk. I tested with sample project and worked fine. I did not get the errors you mentioned.
download the apk in the following link and test it. let me know if it works on your device,
It is compiled with b4a 12.
https://www.dropbox.com/s/bgn8isn5eyr9d0c/authsample.zip?dl=1
If it works, the problem may be in firebase sdk. It looks like there is an issue with it that affects apps that are published on playstore and have a long name.
the example that you sent me takes the phone number from the device and does auto verification, this is working fine with me, my case is if we want to enter the verification code manually if i put the code correct there is no problem but if i put the code wrong the app crashes.
pls note i made sure that i have the correct sdk and all i have downloaded is correct

kindly try the case that i am asking about once you put the code wrong

thank you
 

Enrico Fuoti

Member
Licensed User
Longtime User
the example that you sent me takes the phone number from the device and does auto verification, this is working fine with me, my case is if we want to enter the verification code manually if i put the code correct there is no problem but if i put the code wrong the app crashes.
pls note i made sure that i have the correct sdk and all i have downloaded is correct

kindly try the case that i am asking about once you put the code wrong

thank you
I added a new version on first post that should have fixed the bug.
 
Top