title: Get access token from google plus Android
body: <p>Can anyone tell me what am I doing wrong? I need to get the access token from Google Plus..</p>
  
  <p>I put this in my <code>onConnected()</code> method but I am not getting the access token, instead I am getting error...</p>
  
  <p>Code:</p>
  
  <pre><code>try {
          String token = GoogleAuthUtil.getToken(this, mPlusClient.getAccountName() + "", "oauth2:" + Scopes.PLUS_PROFILE + 
                                  "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email");
          Log.d("AccessToken", token);
      } catch (UserRecoverableAuthException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (GoogleAuthException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>08-07 10:10:24.199: E/GoogleAuthUtil(17203): Calling this from your main thread can lead to deadlock and/or ANRs
  </code></pre>
  
  <p>Can anyone tell me what would be the correct way to get the Google Plus access token from the user?</p>