firebase-ios-sdk
firebase-ios-sdk copied to clipboard
[auth] `creationTime` is always equal to `lastSignInTime`
Description
When signing in anonymously, then linking the anonymous with an email/password credential, we always get the creationDate
and lastSignInDate
equals even tho we didn't create and sign in at the same time.
First reported here: https://github.com/firebase/flutterfire/issues/9640
Reproducing the issue
[[FIRAuth auth] signInAnonymouslyWithCompletion:^(FIRAuthDataResult * _Nullable authResult,
NSError * _Nullable error) {
FIRAuthCredential *credential =
[FIREmailAuthProvider credentialWithEmail:email
password:password];
[[FIRAuth auth].currentUser linkWithCredential:credential
completion:^(FIRAuthDataResult *result, NSError *_Nullable error) {
// Expect creationDate and lastSignInDate to be different
}];
}];
Firebase SDK Version
10.3.0
Xcode Version
14.2
Installation Method
CocoaPods
Firebase Product(s)
Authentication
Targeted Platforms
iOS
Relevant Log Output
No response
If using Swift Package Manager, the project's Package.resolved
Expand Package.resolved
snippet
Replace this line with the contents of your Package.resolved.
If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock
snippet
Replace this line with the contents of your Podfile.lock!
Thanks for reporting this, @Lyokone. Per checking, I was able to reproduce the same behavior, but it seems like this is intended because when you sign in using an anonymous account, it will automatically create an account with a UUID and then it will login at the same time. If this is not the case, please share detailed steps to reproduce the issue.
Thanks for reporting this, @Lyokone. Per checking, I was able to reproduce the same behavior, but it seems like this is intended because when you sign in using an anonymous account, it will automatically create an account with a UUID and then it will login at the same time. If this is not the case, please share detailed steps to reproduce the issue.
Hello, I am the original poster of this issue in the flutterfire repo.
Just to clarify on the issue, the account has already been created/linked: It's when an app is launched that the creationTime
and lastSignInTime
are the same.
In addition, signing out and back in will return the correct creationTime
and lastSignInTime
if getting the metadata directly from the firebase auth instance, but not from the listener that returns the user's metadata, so there's some sort of disconnect there.
Hi @AdamBridges, regarding this statement:
Just to clarify on the issue, the account has already been created/linked: It's when an app is launched that the creationTime and lastSignInTime are the same.
To see that we're on the same page, could you clarify the steps to replicate the issue below:
- Sign in anonymously
- Link to email/password account
- Sign out
- Sign in again using the email/pass account
If that's the case, I tested again and it's working fine on my end using the Auth.auth().addStateDidChangeListener
since userChanges().listen
is not available on native iOS.
Hi @AdamBridges, regarding this statement:
Just to clarify on the issue, the account has already been created/linked: It's when an app is launched that the creationTime and lastSignInTime are the same.
To see that we're on the same page, could you clarify the steps to replicate the issue below:
- Sign in anonymously
- Link to email/password account
- Sign out
- Sign in again using the email/pass account
If that's the case, I tested again and it's working fine on my end using the
Auth.auth().addStateDidChangeListener
sinceuserChanges().listen
is not available on native iOS.
Okay, then it's possible that the issue still lies in the firebase_auth package of the flutterfire repo.
@Lyokone should be able to clarify further.
Hey @Lyokone. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Thanks for investigating, I'll have another look on my end
Hey @Lyokone. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@Lyokone if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.