title: Firebase Auth: can't instantiate AuthCredential
body: <p>I am trying to make a Master User module, which user can delete other users. I read from other questions, that if you want to delete a user, You must logged in as that user. And then, I realize that you could sign in with credential information stored by firebase auth. (for references, I use google, facebook and email method).</p>
  
  <p>I also store a User entity in my Firebase Database which correspond to Firebase Auth. Here is my User class :</p>
  
  <pre><code>public class User {
          // variables.
          private String appId;
          private String email;
          private String name;
          private String description;
          private String photoUrl;
          private boolean isAdmin;
          private boolean isSuspended;
          private boolean isDeleted;
          private AuthCredential credential;
  
          // all those getters and setters go here.
  }
  </code></pre>
  
  <p>Notice that I store a AuthCredential instance in my user, which I set for the first time when I sign up this user, ( or sign in with facebook and google).
  Whenever I sign up / sign in, I got this error:</p>
  
  <pre><code>java.lang.RuntimeException: java.lang.InstantiationException: can't instantiate class com.google.firebase.auth.AuthCredential
  </code></pre>
  
  <p>BUT, I check my firebase database, and the credential is inserted.</p>
  
  <p><a href="https://i.stack.imgur.com/NCnrx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NCnrx.png" alt="1. FirebaseAuth using email and password."></a>
  <strong>Firebase Auth using email and password.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/610t4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/610t4.png" alt="2. FirebaseAuth using google provider"></a>
  <strong>Firebase Auth using google provider.</strong></p>
  
  <p>My question is, what is the right method to store my user credential in firebase database and recover it again? 
  Also, I don't know if what I'm doing is right, but my point is, I want to delete another user from some admin user. To do that, in my master user module, I'm gonna store my admin user credential, then I sign in as the user who will be deleted, delete myself, and the re-sign in to admin user by using stored admin user credential. Is there any other way to achieve this?</p>
  
  <p>Thank You for your help. </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I got error whenever I do this :</p>
  
  <pre><code>User curUser = dataSnapshot.getValue(User.class);
  </code></pre>
  
  <p>... which is fine before I add AuthCredential instance in my user class.</p>