title: Google play service authentication (oauth 2.0)
body: <p>I wish to authenticate users of my android application whith the oauth2 protocole, so as to the user don't need to create a login and password for my app.</p>
  
  <p>To do that, I follow the following tutorial : <a href="http://android-developers.blogspot.fr/2013/01/verifying-back-end-calls-from-android.html" rel="nofollow">http://android-developers.blogspot.fr/2013/01/verifying-back-end-calls-from-android.html</a></p>
  
  <p>I've import the google play service sdk sample (in AndroidSDK\extras\google\google_play_services\samples\auth), and I have change the scope value.</p>
  
  <p>However, I don't manage to get authentication token... While I've correctly configure my google console API.</p>
  
  <p>Here is the function calling getToken method :</p>
  
  <pre><code>  protected String fetchToken() throws IOException {
        try {
            return GoogleAuthUtil.getToken(mActivity, mEmail, mScope);
        } catch (GooglePlayServicesAvailabilityException playEx) {
            // GooglePlayServices.apk is either old, disabled, or not present.
            mActivity.showErrorDialog(playEx.getConnectionStatusCode());
        } catch (UserRecoverableAuthException userRecoverableException) {
            // Unable to authenticate, but the user can fix this.
            // Forward the user to the appropriate activity.
            mActivity.startActivityForResult(userRecoverableException.getIntent(), mRequestCode);
        } catch (GoogleAuthException fatalException) {
            onError("Unrecoverable error " + fatalException.getMessage(), fatalException);
        } 
        return null;
    }
  </code></pre>
  
  <p>And here is my scope : <code>audience:server:client_id:MY_CLIENT_ID.apps.googleusercontent.com</code></p>
  
  <p>When I try that, I get the following exceptions  :</p>
  
  <pre><code>08-16 17:22:08.471: E/TokenInfoTask(16546): Exception: 
  08-16 17:22:08.471: E/TokenInfoTask(16546): com.google.android.gms.auth.GoogleAuthException: Unknown
  08-16 17:22:08.471: E/TokenInfoTask(16546):     at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
  </code></pre>