title: Calling GetIdTokenAsync() in Firebase Phone Auth throws NullPointerException in Xamarin
body: <p>I'm trying to implement Firebase phone authentication in a Xamarin.Forms app. The otp authentication happens successfully and User object is received. But while calling GetIdTokenAsync(false), I receive a NullPointerException.</p>
  
  <p>Here is the the block</p>
  
  <pre><code>public async Task&lt;string&gt; SignInWithPhoneAuthCreds(string otp)
          {
              try
              {
                  PhoneAuthCredential credential = PhoneAuthProvider.GetCredential(_phoneAuthCallbacks.VerificationId, otp);
                  var signInTask = await _auth.SignInWithCredentialAsync(credential);
                  var user = signInTask.User;
                  var token = await user.GetIdTokenAsync(false);
                  return user.PhoneNumber;
              }
              catch (Exception e)
              {
                  return "";
              }
          }
  </code></pre>
  
  <p>I receive the following error while making the GetIdTokenAsync call</p>
  
  <pre><code>{Java.Lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.firebase.auth.FirebaseAuth.zza(com.google.firebase.auth.FirebaseUser, boolean)' on a null object reference
    at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x0006e] in &lt;26521a5118b44c858c385715922b9d5d&gt;:0 
    at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in &lt;26521a5118b44c858c385715922b9d5d&gt;:0 
    at Firebase.Auth.FirebaseUser.GetIdToken (System.Boolean p0) [0x00022] in &lt;fd3fe568403d40c2b79ab43d84a24199&gt;:0 
    at Firebase.Auth.FirebaseUser.GetIdTokenAsync (System.Boolean forceRefresh) [0x00000] in &lt;fd3fe568403d40c2b79ab43d84a24199&gt;:0 
    at LawDiary.Droid.AuthDroid.SignInWithPhoneAuthCreds (System.String otp) [0x000d8] in C:\Users\pratik.khandelwal\source\repos\LawDiary\LawDiary\LawDiary.Android\AuthDroid.cs:56 
    --- End of managed Java.Lang.NullPointerException stack trace ---
  java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.tasks.Task com.google.firebase.auth.FirebaseAuth.zza(com.google.firebase.auth.FirebaseUser, boolean)' on a null object reference
      at com.google.firebase.auth.FirebaseUser.getIdToken(Unknown Source:4)
      at crc6495d4f5d63cc5c882.AwaitableTaskCompleteListener_1.n_onComplete(Native Method)
      at crc6495d4f5d63cc5c882.AwaitableTaskCompleteListener_1.onComplete(AwaitableTaskCompleteListener_1.java:30)
      at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
      at android.os.Handler.handleCallback(Handler.java:883)
      at android.os.Handler.dispatchMessage(Handler.java:100)
      at android.os.Looper.loop(Looper.java:214)
      at android.app.ActivityThread.main(ActivityThread.java:7356)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
  }
  </code></pre>