[Firebase Auth] Possibility to use AuthCredential with Apple provider more than once. #8247
Unanswered
yamauchieduardo
asked this question in
Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Explanation why I need this feature:
In Firebase Projects we have some diffent types of AuthCredential, some can be used once time, and another more than once.
AuthCredential that can be once time: PhoneAuth.
AuthCredential that can be used more once time: GoogleAuthCredential & FacebookAuthCredential.
signInWithCredential
,linkWithCredential
.For Example:
linkWithCredential
and after that I CAN REUSE the same credential tosignInWithCredential
(GoogleAuthCredential or FacebookAuthCredential).linkWithCredential
and CAN'T REUSE the same credential tosignInWithCredential
(PhoneAuthCredential).Actually Apple Login doesn't have any specific class to login, usually we use OAuthCredential to login with Apple.
Observation:
In my project have an important requirement: The users NEED to have a custom UID.
To solve this problem, I build two paths:
The first path is when the user give me an AuthCredentials than can be used MORE THAN ONCE (GoogleAuthCredential, FacebookAuthCredential, etc).
1 - I login the user using
signInWithCredential
method.1.a - if the FirebaseCurrentUser have a custom Id finishes the login process.
1.b - if the FirebaseCurrentUser don't have a custom id:
1.b.1 - I loggout the user.
1.b.2 - I delete the user account.
1.b.3 - I create a new account using custom-token (that have a custom-id).
1.b.4 - Link the new account (custom-id) with the AuthCredential (that the users give me) and finish the login process.
The second path is when the user give me an AuthCredential than can be used JUST ONCE (PhoneCredential).
1 - I use a Firebase-Function (admin.auth) to check if the user already have an account (using some identifier, like phone for PhoneCredential).
1.a - If the user already have an account, login the user using
signInWithCredential
method and finish the login process.1.b - If the user don't have account:
1.b.1 - I create a new account using custom-token (that have a custom-id).
1.b.2 - Link the new account (custom-id) with the AuthCredential (that the users give me) and finish the login process.
This worked fine, until I notice that AppleProvider could don't have ANY IDENTIFIER (because the user can choose to anonymize all data).
If the Apple Credential can be REUSED, I can use the first path to build accounts with custom-id.
Without the possibility to reuse the Apple AuthCredential this type of workaround can't be possible.
Thanks for the attention.
Beta Was this translation helpful? Give feedback.
All reactions