title: Token null Sign-in Google Account
body: <p>I am following the example of google to get the token but without success.
  Always fails to acquire the token.
  This is latest way Google displays on your page developers
  I believe the error is not in my code</p>
  
  <pre><code>  private String CLIENTE_ID = "...apps.googleusercontent.com";
  
  
  
  GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
              .requestIdToken(CLIENTE_ID)
              .requestEmail()
              .build();
  
  // Build GoogleAPIClient with the Google Sign-In API and the above options.
  mGoogleApiClient = new GoogleApiClient.Builder(this)
              .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
              .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
              .build();
  
  imgBGoogle.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
  
              Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
              startActivityForResult(signInIntent, 9002);
          }
  });
  
  
  
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
          if (requestCode == 9002) {
              GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
  
              handleSignInResult(result, data);
  
          }
  
  if (requestCode == 9002) {
              // [START get_id_token]
              GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
              Log.d(TAG, "onActivityResult:GET_TOKEN:success:" + result.getStatus().isSuccess());
  
              if (result.isSuccess()) {
                  GoogleSignInAccount acct = result.getSignInAccount();
                  String idToken = acct.getIdToken();
  
                  // Show signed-in UI.
                  Log.d(TAG, "idToken:" + idToken);
                  Log.d(TAG, "\n ");
  
                  // TODO(user): send token to server and validate server-side
              } else {
                  // Show signed-out UI.
                  Log.d(TAG, "idToken: fail");
  
              }
              // [END get_id_token]
          }
  
  
  
  }
  
  private void handleSignInResult(GoogleSignInResult result, Intent data) {
  
          getToken1(data);
          getToken2(result);
  
          String BOOKS_API_SCOPE = "https://www.googleapis.com/auth/books";
          String GPLUS_SCOPE = "https://www.googleapis.com/auth/plus.login";
          String mScopes = "oauth2:" + BOOKS_API_SCOPE + " " + GPLUS_SCOPE;
  
  }
  
  
  void getToken1(Intent data){
  
      GoogleSignInResult a = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
  
      if (a.isSuccess()) {
  
          Log.d(TAG, "TOKEN 1: " + a.getSignInAccount().getIdToken());
          Log.d(TAG, "DISPLAY NAME 1: " +a.getSignInAccount().getDisplayName());
          Log.d(TAG, "ID 1: " + a.getSignInAccount().getId()+"\n ");
  
      }else{
          Log.d(TAG, "ID 1: falhou"+"\n ");
      }
  
  }
  
  void getToken2(GoogleSignInResult result){
  
          if (result.isSuccess()) {
  
              GoogleSignInAccount acct = result.getSignInAccount();
  
              Log.d(TAG, "TOKEN 2: " + acct.getIdToken());
              Log.d(TAG, "DISPLAY NAME 2: " + acct.getDisplayName());
              Log.d(TAG, "ID 2: " + acct.getId()+"\n ");
  
          }else{
              Log.d(TAG, "ID 2: falhou"+"\n ");
          }
  
  }
  </code></pre>
  
  <p><strong>how can I get the token?
  can anyone help me?</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Uj0LO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Uj0LO.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/6keg0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6keg0.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/csq4D.png" rel="noreferrer"><img src="https://i.stack.imgur.com/csq4D.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/p2zSX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p2zSX.png" alt="enter image description here"></a></p>