FirebaseUI-iOS icon indicating copy to clipboard operation
FirebaseUI-iOS copied to clipboard

Add a 'reauthenticate' function

Open samtstern opened this issue 8 years ago • 6 comments

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 avatar Feb 21 '17 17:02 samtstern

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

samtstern avatar Mar 13 '17 20:03 samtstern

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

yramanchuk avatar Mar 24 '17 00:03 yramanchuk

@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 avatar Mar 24 '17 16:03 samtstern

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.

samtstern avatar Apr 26 '17 00:04 samtstern

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.

wayneforrest avatar Nov 14 '17 19:11 wayneforrest

@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.

morganchen12 avatar Nov 14 '17 19:11 morganchen12