title: Delete account in firebase in objective c
body: <p>AppStore rejected my App and asked me to provide a deleted account when I have account creation. I am using Sign in with Apple, Google, and Email.</p>
  <p>To delete the account I followed the documents in firebase. But then received an error FIRAuthErrorCodeRequiresRecentLogin</p>
  <blockquote>
  <p>&quot;Delete account error This operation is sensitive and requires recent
  authentication. Log in again before retrying this request.&quot;</p>
  </blockquote>
  <pre><code>FIRUser* user = [ [ FIRAuth auth ] currentUser ];
  
  [ user deleteWithCompletion:^(NSError * _Nullable error) {
      
      if( error )
      {
          // An error happened.
          if( error.code == FIRAuthErrorCodeRequiresRecentLogin)
          {
               return;
          }
       }
    }
  </code></pre>
  <p>Upon checking the error I understand that I need to reauthenticate and delete the account. After signing in it gives me 5 minutes that I can delete my account.</p>
  <p>What I did is when I got the error FIRAuthErrorCodeRequiresRecentLogin, I will request the user to Sign out and Sign in again, then delete the account. This works but this is not the right way I think. No one will want to relog again by signing out.</p>
  <p>Can someone help me with how I can reauthenticate by getting the credential that was signed by google, apple, and email?</p>
  <pre><code>            // How to get a credential when I am already signed in via google, apple, or email?
              FIRAuthCredential* credential;
              
              NSLog( @&quot;Delete account error %@&quot;, error.localizedDescription );
              
              [[FIRAuth auth].currentUser reauthenticateWithCredential:credential completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) {
                  
                  NSLog( @&quot;Error %@&quot;, error);
              }];
  </code></pre>