Can the Firebase Auth Plugin find the providerId?

Greeting @Scott_Harrison ,

Does the plugin have a function to look up the provider, similar to: profile.providerId === “apple.com”?

Because for Android phone users, using Apple SingIn requires entering their account and password every time, which is not user-friendly.

Now I use string.ends( firebaseAuth.getEmail(), “appleid.com” ) to check if it is an Apple login, so that they can enter the game directly without having to enter their account and password every time, but this only works if the user chooses to hide the mailbox.

If I know that the providerId is “apple.com” or “google.com”, I can make a judgment and let users switch accounts and enter the game more easily.

Is there such a function or can it be added?

Thank you. :heart:

Let me take a look

1 Like

Pushed update

see firebaseAuth.getProvider()
https://scotth.tech/plugin/firebaseAuth

1 Like

Thank you for all your hard work.

Now FirebaseAuth has become an invincible plugin and I recommend it to others in the community too.

The following is the implementation method↓

Since FirebaseAuth will automatically record once a login has been made, you can use “firebaseAuth.isSignedIn()” to check the login, which will usually display “true”.

Then you can use “firebaseAuth.getProvider()” to check the login provider.

When the player clicks Google login button, checked that the original login provider is “google.com”.

If yes you don’t need to do anything and let the player log in directly.

When the player clicks Apple login button,use “firebaseAuth.signOut” to log out the player,and re-execute the login function.

Vice versa.

Now we can allow players to log in quickly and increase the player’s experience.

In addition, set logout button when players want to switch to a different Google account or Apple account.

2 Likes

Thank you, very helpful!

1 Like

Greeting,

I recently had some time to test out the new changes to FirebaseAuth, but I noticed something a little kinky.

The first is that firebaseAuth.getProvider() will always return just “firebase”.

This seems to be because user.providerId will only ever return this set of numbers.

Only user.providerData[n].providerId will return data such as “google.com”.

Hope you can check it out.

Another problem is that the original build of the IOS version was normal, but after the firebaseAuth update it cannot be built and the following message will appear↓


ERROR: Builder failed: ld: warning: -ld_classic is deprecated and will be removed in a future release
May 21 00:13:43.423 ld: library not found for -lplugin_firebaseAuth
                    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
May 21 00:13:43.423 BUILD ERROR: There was a problem linking the app.
                   
                    Check the console for more information.
May 21 00:13:43.423
May 21 00:13:45.307 iOS build failed (2) after 34 seconds
May 21 00:13:45.632 ERROR: Build Failed: There was a problem linking the app.
                   
                    Check the console for more information.

Additional note: The problem only occurs on the iOS build, everything is normal on Android.

I will take a look in a few, thanks for reporting

1 Like

@vb66r55 a fix just went out for this build issue :slight_smile:

1 Like

Thank you, now the IOS version can be built successfully.

In addition, I tested firebaseAuth.getProvider() on an iPad, and it indeed only returns “firebase”, which is the same result produced by an Android phone.

Hope this information can help you fix. :handshake:

post new api see
firebaseAuth.getProviders()

https://scotth.tech/plugin/firebaseAuth

1 Like

Thank you, the problem has been solved. :handshake:

The results of the test.

local CheckFireProvider = firebaseAuth.getProviders()
print(CheckFireProvider[1]) -- "firebase"
print(CheckFireProvider[2]) -- like "google.com" like "apple.com"
1 Like