firebase / FirebaseUI-iOS

iOS UI bindings for Firebase.
Apache License 2.0
1.51k stars 475 forks source link

Add a 'reauthenticate' function #247

Open samtstern opened 7 years ago

samtstern commented 7 years ago

Many Firebase operations (account delete, update email, etc) require a recent (~5mins) authentication in order to succeed. We should provide a convenience function/flow to re-authenticate the current user.

@amandle has already implemented this on Android (PR not yet merged, planned for version 2.0) Android issue: https://github.com/firebase/FirebaseUI-Android/issues/563 Android implementation: https://github.com/firebase/FirebaseUI-Android/pull/583

samtstern commented 7 years ago

FYI firebase/FirebaseUI-Android#583 was merged into our version-2.0.0-dev branch.

yramanchuk commented 7 years ago

if I'm not mistaken all mentioned operations are implemented in Account Management flow (https://github.com/firebase/FirebaseUI-iOS/pull/261) which has re-authenticate feature

samtstern commented 7 years ago

@yramanchuk this is true. But we need to expose the reauthenticate function separate from that flow to meet the original developer request.

It would also be good if you have time to implement reauth first since @amandle already did that and account management could take a lot longer.

samtstern commented 7 years ago

Although we have put account management on the backburner, I would still like to get this done since the work has already been done for Android.

Yury / Morgan does either of you have time for this before the next release? I could always make the Android version private and expose it in a later release but that would be a bummer since @amandle did good work.

wayneforrest commented 6 years ago

I have used FUIPhoneAuth with signInWithPresentingViewController: and now need to reauthenticateWithCredential:

My problem is I cannot get hold of the "verificationID", which I then can use to get the FIRAuthCredential in order to re-authenticate.

How do I proceed to do this currently?

Some doc recommends this when not using FUIPhoneAuth (1) [[FIRPhoneAuthProvider provider] verifyPhoneNumber:userInput UIDelegate:nil completion:^(NSString * _Nullable verificationID ....

//save the verificationID in some user preferences...

(2) FIRAuthCredential *credential = [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID verificationCode:userInput];

etc.

morganchen12 commented 6 years ago

@wayneforrest you should be able to use that method regardless of whether or not you're using phone auth. Please file a separate issue for your question.