title: java.lang.IllegalArgumentException: Must specify an idToken or an accessToken
body: <p>I am trying to implement google sign in authentication using firebase.
  I was following <a href="https://www.youtube.com/watch?v=-ywVw2O1pP8&amp;t=4s" rel="noreferrer">this</a> tutorial.</p>
  
  <p>Error log :</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Failure delivering result
    ResultInfo{who=null, request=1002, result=-1, data=Intent { (has
    extras) }} to activity
    {com.clabs.codefosterapp/com.clabs.codefosterapp.SplashActivity}:
    java.lang.IllegalArgumentException: Must specify an idToken or an
    accessToken.</p>
    
    <p>at android.app.ActivityThread.deliverResults(ActivityThread.java:3389)
                                                                                     at
    android.app.ActivityThread.handleSendResult(ActivityThread.java:3432)
                                                                                     at android.app.ActivityThread.access$1300(ActivityThread.java:135)
                                                                                     at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                     at android.os.Looper.loop(Looper.java:136)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5045)
                                                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                                                     at java.lang.reflect.Method.invoke(Method.java:515)
                                                                                     at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                                                     at dalvik.system.NativeStart.main(Native Method)
                                                                                  Caused by: java.lang.IllegalArgumentException: Must specify an idToken
    or an accessToken.
                                                                                     at com.google.firebase.auth.GoogleAuthCredential.(Unknown
    Source)
                                                                                     at com.google.firebase.auth.GoogleAuthProvider.getCredential(Unknown
    Source)
                                                                                     at
    com.clabs.codefosterapp.SplashActivity.firebaseAuthWithGoogle(SplashActivity.java:102)
                                                                                     at
    com.clabs.codefosterapp.SplashActivity.onActivityResult(SplashActivity.java:91)
                                                                                     at android.app.Activity.dispatchActivityResult(Activity.java:5423)
                                                                                     at android.app.ActivityThread.deliverResults(ActivityThread.java:3385)
                                                                                     at
    android.app.ActivityThread.handleSendResult(ActivityThread.java:3432) 
                                                                                     at android.app.ActivityThread.access$1300(ActivityThread.java:135) 
                                                                                     at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                     at android.os.Looper.loop(Looper.java:136) 
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:5045) 
                                                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                                                     at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                                                     at dalvik.system.NativeStart.main(Native Method)</p>
  </blockquote>
  
  <p>Crashing at following line</p>
  
  <pre><code> AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
  </code></pre>
  
  <p>My code :</p>
  
  <pre><code>private void googleSignIn() {
          Intent intent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
          startActivityForResult(intent, SIGN_IN);
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == SIGN_IN) {
              GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
              if (result.isSuccess()) {
                  GoogleSignInAccount account = result.getSignInAccount();
                  firebaseAuthWithGoogle(account);
              } else {
  
                  Toast.makeText(SplashActivity.this, "Oops! Something Went Wrong", Toast.LENGTH_SHORT).show();
              }
  
          }
      }
  private void firebaseAuthWithGoogle(GoogleSignInAccount account) {
  
          AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null);
          mAuth.signInWithCredential(credential)
                  .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                          if (!task.isSuccessful()) {
                              Toast.makeText(SplashActivity.this, "Authentication Failed", Toast.LENGTH_SHORT).show();
                          }
                      }
                  });
      }
  </code></pre>