title: OAuth2 invalid_token when verifying Google Sign In with getIdToken() and getServerAuthCode()
body: <p>I followed this guide for Google Sign-In for Android: <a href="https://developers.google.com/identity/sign-in/android/sign-in" rel="nofollow">https://developers.google.com/identity/sign-in/android/sign-in</a></p>
  
  <p>I can successfully sign in but I am not sure if I should be using <code>getIdToken()</code> or <code>getServerAuthCode()</code> as an access token.</p>
  
  <p>I tried passing both of them, one at a time, to <a href="https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=[access_token]" rel="nofollow">https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=[access_token]</a> but it always returns with:</p>
  
  <blockquote>
    <p>{  "error": "invalid_token",  "error_description": "Invalid Value" }</p>
  </blockquote>
  
  <p>Here is what I think are the relevant parts of my code:</p>
  
  <pre><code>    // Configure sign-in to request the user's ID, email address, and basic
      // profile. ID and basic profile are included in DEFAULT_SIGN_IN.
      GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
              .requestEmail()
              .requestIdToken(getString(R.string.server_client_id))
              .requestServerAuthCode(getString(R.string.server_client_id))
              .requestScopes(new Scope(Scopes.EMAIL))
              .requestScopes(new Scope(Scopes.PROFILE))
              .build();
  
      // Build a GoogleApiClient with access to the Google Sign-In API and the
      // options specified by gso.
      mGoogleApiClient = new GoogleApiClient.Builder(this)
              .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
              .build();
  
  private void handleSignInResult(GoogleSignInResult result) {
  Log.d(TAG, "handleSignInResult:" + result.isSuccess());
  if (result.isSuccess()) {
      // Signed in successfully, show authenticated UI.
      GoogleSignInAccount acct = result.getSignInAccount();
      // I also tried String googleAccessToken = acct.getIdToken();
      String googleAccessToken = acct.getServerAuthCode();
  
      ...
  
      // Omitted code to make POST request to server
      ...
  
  } else {
      // Signed out, show unauthenticated UI.
  }
  </code></pre>
  
  <p>I've been googling for a few hours but to no avail. Thank you.</p>
  
  <p>EDIT:</p>
  
  <p>Sorry, I think I missed a step. I'm going to try going through this: developers.google.com/android/guides/http-auth and give it another shot using GoogleAuthUtil.getToken() </p>