firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
202 stars 35 forks source link

[FR] Add option not to create new user for SignInWithCredentialAsync and SignInWithProvider #655

Open Sitiyoh opened 1 year ago

Sitiyoh commented 1 year ago

Feature proposal

Currently FirebaseAuth.SignInWithCredentialAsync creates new user if there is no user linked with that credential. This behavior overwrites the currently logged-in user with the new user, but if the user with the credentials is not found, I want to keep the already logged-in user information. Is there any plan of adding an option to SignInWithCredentialAsync / SignInWithProviderAsync to not to create new user when no user was previously logged in?

google-oss-bot commented 1 year ago

I found a few problems with this issue:

Thaina commented 1 year ago

I have request similar feature with alternative approach https://github.com/firebase/firebase-js-sdk/issues/1945#issuecomment-696276275

not sure there is already API to support that yet and how b/169068814 was resolved. But I would expect that, there should be another API on client side to verify that the credential or IDToken already exist. Then we call SignIn when it's not

Sitiyoh commented 1 year ago

Hi @Thaina Thanks for the information.

Firebase Unity SDK can verify user using LinkWithCredentialAsync to know that the user has linked credential with another user, and can sign into that user by SignInWithCredentialAsync. But this approach requires 2x full login sequence to user for specific authentication like Sign In With Apple/Android (not ios) since LinkWithProviderAsync does not have alternative function LinkAndRetrieveDataWithProviderAsync . https://firebase.google.com/docs/auth/unity/apple#on-android Asking to login twice for authentication is not what I am looking for, so that was the reason I wanted SignInWithCredentialAsync not to create user when user was not found.

I use Firebase JS a liitle bit too so I know Firebase JS have same problem too and your request is not yet solved. I hope that Firebase team see these requests and work around with this.