Marcos Alves Well-Known Member Licensed User Longtime User Jun 15, 2021 #1 Hello all, Using Facebook library to authenticate in B4i I noticed that, when an authentication error occurred, the library was receiving the error event but wasn't triggering it in B4i which turned impossible to manage error conditions. @Erel updated B4i Facebook library in this post : https://www.b4x.com/android/forum/threads/firebase-facebook-authentication.130898/#post-828821 , which fixed the problem for IOS. Now I have the same issue in B4A (the FB error event is showed in log but doesn't trigger an event). I think that's the same situation. Is there any workaround here or the unique solution is to create an updated Facebook library in B4A (adding the event facebook.initialize2(event_name) like @Erel did in the equivalent thread in b4i?) Does anybody can help? Thanks community!
Hello all, Using Facebook library to authenticate in B4i I noticed that, when an authentication error occurred, the library was receiving the error event but wasn't triggering it in B4i which turned impossible to manage error conditions. @Erel updated B4i Facebook library in this post : https://www.b4x.com/android/forum/threads/firebase-facebook-authentication.130898/#post-828821 , which fixed the problem for IOS. Now I have the same issue in B4A (the FB error event is showed in log but doesn't trigger an event). I think that's the same situation. Is there any workaround here or the unique solution is to create an updated Facebook library in B4A (adding the event facebook.initialize2(event_name) like @Erel did in the equivalent thread in b4i?) Does anybody can help? Thanks community!
Erel B4X founder Staff member Licensed User Longtime User Jun 16, 2021 #2 Can you post the logs when there is an error? Upvote 0
Marcos Alves Well-Known Member Licensed User Longtime User Jun 16, 2021 #3 Erel said: Can you post the logs when there is an error? Click to expand... Hello @Erel , Good morning ! Follows the log : Facebook - SignIn ** Activity (mainpage) Pause, UserClosed = false ** sending message to waiting queue (OnActivityResult) running waiting messages (1) Facebook - ResultArrived: Intent { (has extras) } Facebook success: com.facebook.login.LoginResult@7ce501c signInWithCredential start ** Activity (mainpage) Resume ** signInWithCredential complete: false error: com.google.firebase.auth.FirebaseAuthUserCollisionException: An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address. Click to expand... Note that I implemented login with Google or Login with FaceBook. If the same e-mail registered in Facebook is already registered in Firebase as google login, Firebase raises this error which doesn't trigger the respective event in B4A (the same was happening in B4i but you updated the library that). In the opposite situation (an email registered in Firebase using Facebook), when trying to login in Google, Firebase simply overrides Facebook login replacing the system authentication method in it's users database to Google (probably because Firebase is a Google product ). That's it. Its the same situation described in B4i with Facebook library. Thanks @Erel ! Upvote 0
Erel said: Can you post the logs when there is an error? Click to expand... Hello @Erel , Good morning ! Follows the log : Facebook - SignIn ** Activity (mainpage) Pause, UserClosed = false ** sending message to waiting queue (OnActivityResult) running waiting messages (1) Facebook - ResultArrived: Intent { (has extras) } Facebook success: com.facebook.login.LoginResult@7ce501c signInWithCredential start ** Activity (mainpage) Resume ** signInWithCredential complete: false error: com.google.firebase.auth.FirebaseAuthUserCollisionException: An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address. Click to expand... Note that I implemented login with Google or Login with FaceBook. If the same e-mail registered in Facebook is already registered in Firebase as google login, Firebase raises this error which doesn't trigger the respective event in B4A (the same was happening in B4i but you updated the library that). In the opposite situation (an email registered in Firebase using Facebook), when trying to login in Google, Firebase simply overrides Facebook login replacing the system authentication method in it's users database to Google (probably because Firebase is a Google product ). That's it. Its the same situation described in B4i with Facebook library. Thanks @Erel !
Erel B4X founder Staff member Licensed User Longtime User Jun 17, 2021 #4 Please try the attached update (1.03). I haven't tested it myself. You need to use FacebookSdk.Initialize2 and it will raise the SignError event in the module where FacebookSdk was initialized. Upvote 0
Please try the attached update (1.03). I haven't tested it myself. You need to use FacebookSdk.Initialize2 and it will raise the SignError event in the module where FacebookSdk was initialized.
Marcos Alves Well-Known Member Licensed User Longtime User Jun 17, 2021 #5 Erel said: Please try the attached update (1.03). I haven't tested it myself. You need to use FacebookSdk.Initialize2 and it will raise the SignError event in the module where FacebookSdk was initialized. Click to expand... Thanks @Erel . I'm testing now and will post the results here. Upvote 0
Erel said: Please try the attached update (1.03). I haven't tested it myself. You need to use FacebookSdk.Initialize2 and it will raise the SignError event in the module where FacebookSdk was initialized. Click to expand... Thanks @Erel . I'm testing now and will post the results here.
Marcos Alves Well-Known Member Licensed User Longtime User Jun 17, 2021 #6 Erel said: Please try the attached update (1.03). I haven't tested it myself. You need to use FacebookSdk.Initialize2 and it will raise the SignError event in the module where FacebookSdk was initialized. Click to expand... Hello @Erel, I just finished to test and worked perfectly. But I noticed some details those could be important before to release the upgrade: 1. You told that this lib release should be 1.03. But in B4A panel, even after replacing the lib, the version remains 1.02 (I tested two times, closed and reopened the framework). Probably you forgot to change the version code. See: 2. When the user cancels the authentication (if the password is incorrect or even if he gives up), Fb raises a "Result" which doesn't raises an event in B4A. This event is raised in B4i and is important because if the app showed a progress dialog when the user called the authentication process it's not possible to dismiss the dialog in the case of user cancel. Follows the log for your convenience: Facebook - SignIn ** Activity (mainpage) Pause, UserClosed = false ** sending message to waiting queue (OnActivityResult) running waiting messages (1) Facebook - ResultArrived: Intent { (has extras) } Facebook cancel ** Activity (mainpage) Resume ** Click to expand... Finally, I tested the successful login, which worked perfectly. Follows the log: Facebook - SignIn ** Activity (mainpage) Pause, UserClosed = false ** sending message to waiting queue (OnActivityResult) running waiting messages (1) Facebook - ResultArrived: Intent { (has extras) } Facebook success: com.facebook.login.LoginResult@6a9ab7a signInWithCredential start ** Activity (mainpage) Resume ** onAuthStateChanged: com.google.firebase.auth.internal.zzn@ff3229f signInWithCredential complete: true ** Activity (mainpage) Pause, UserClosed = true ** Killing previous instance (partnersearch). ** Activity (partnersearch) Create, isFirst = false ** ** Activity (partnersearch) Resume ** Click to expand... That's it. In my situation the new library is perfect. To publish as a release I think that it's needed to fix the version code (1.02 -> 1.03) and maybe to add the cancel event. Again, thanks @Erel for your agility and kindness as always. B4X is certainly the worlds best framework for multiplatform development because your efforts! Thanks! Upvote 0
Erel said: Please try the attached update (1.03). I haven't tested it myself. You need to use FacebookSdk.Initialize2 and it will raise the SignError event in the module where FacebookSdk was initialized. Click to expand... Hello @Erel, I just finished to test and worked perfectly. But I noticed some details those could be important before to release the upgrade: 1. You told that this lib release should be 1.03. But in B4A panel, even after replacing the lib, the version remains 1.02 (I tested two times, closed and reopened the framework). Probably you forgot to change the version code. See: 2. When the user cancels the authentication (if the password is incorrect or even if he gives up), Fb raises a "Result" which doesn't raises an event in B4A. This event is raised in B4i and is important because if the app showed a progress dialog when the user called the authentication process it's not possible to dismiss the dialog in the case of user cancel. Follows the log for your convenience: Facebook - SignIn ** Activity (mainpage) Pause, UserClosed = false ** sending message to waiting queue (OnActivityResult) running waiting messages (1) Facebook - ResultArrived: Intent { (has extras) } Facebook cancel ** Activity (mainpage) Resume ** Click to expand... Finally, I tested the successful login, which worked perfectly. Follows the log: Facebook - SignIn ** Activity (mainpage) Pause, UserClosed = false ** sending message to waiting queue (OnActivityResult) running waiting messages (1) Facebook - ResultArrived: Intent { (has extras) } Facebook success: com.facebook.login.LoginResult@6a9ab7a signInWithCredential start ** Activity (mainpage) Resume ** onAuthStateChanged: com.google.firebase.auth.internal.zzn@ff3229f signInWithCredential complete: true ** Activity (mainpage) Pause, UserClosed = true ** Killing previous instance (partnersearch). ** Activity (partnersearch) Create, isFirst = false ** ** Activity (partnersearch) Resume ** Click to expand... That's it. In my situation the new library is perfect. To publish as a release I think that it's needed to fix the version code (1.02 -> 1.03) and maybe to add the cancel event. Again, thanks @Erel for your agility and kindness as always. B4X is certainly the worlds best framework for multiplatform development because your efforts! Thanks!
Marcos Alves Well-Known Member Licensed User Longtime User Jun 17, 2021 #7 Marcos Alves said: 1. You told that this lib release should be 1.03. But in B4A panel, even after replacing the lib, the version remains 1.02 (I tested two times, closed and reopened the framework). Probably you forgot to change the version code. See: Click to expand... Forget this. My fault ! On line version 1.02. Local version 1.03. Correct! Upvote 0
Marcos Alves said: 1. You told that this lib release should be 1.03. But in B4A panel, even after replacing the lib, the version remains 1.02 (I tested two times, closed and reopened the framework). Probably you forgot to change the version code. See: Click to expand... Forget this. My fault ! On line version 1.02. Local version 1.03. Correct!
Erel B4X founder Staff member Licensed User Longtime User Jun 20, 2021 #8 I've uploaded v1.03. It will handle the cancel case: https://www.b4x.com/android/forum/t...firebaseauth-to-support-facebook.67954/page-1 Upvote 0
I've uploaded v1.03. It will handle the cancel case: https://www.b4x.com/android/forum/t...firebaseauth-to-support-facebook.67954/page-1
Marcos Alves Well-Known Member Licensed User Longtime User Jun 21, 2021 #9 Erel said: I've uploaded v1.03. It will handle the cancel case: https://www.b4x.com/android/forum/t...firebaseauth-to-support-facebook.67954/page-1 Click to expand... Thanks @Erel Upvote 0
Erel said: I've uploaded v1.03. It will handle the cancel case: https://www.b4x.com/android/forum/t...firebaseauth-to-support-facebook.67954/page-1 Click to expand... Thanks @Erel