title: Google Authentication with a Backend Server required Scopes
body: <p>I am following <a href="https://developers.google.com/identity/sign-in/android/backend-auth" rel="nofollow">these instructions</a> (<a href="https://developers.google.com/identity/sign-in/android/backend-auth" rel="nofollow">https://developers.google.com/identity/sign-in/android/backend-auth</a>) for getting an ID token to be sent to my Backend but when I set <code>String scopes = "audience:server:client_id:" + Service.SERVER_CLIENT_ID;</code> (Yes the <code>SERVER_CLIENT_ID</code> is not the Android Client ID) I fail to get a token and throws this error. </p>
  
  <p><code>E/Login: com.google.android.gms.auth.GoogleAuthException: Unknown</code></p>
  
  <p>However when I use the following scope instead
  <code>String scopes = "oauth2:profile email";</code></p>
  
  <p>I successfully get 'a' token but it's not as long as I expected it to be and I'm afraid it might be wrong. </p>
  
  <p>My questions are...</p>
  
  <p>1) Why doesn't the <code>scopes = "audience:server:client_id:" + SERVER_CLIENT_ID;</code> used in the guide work?</p>
  
  <p>2) Is the token I get from using <code>String scopes = "oauth2:profile email";</code> a safe one for verifying a user on a Backend?</p>
  
  <p>The code is below.</p>
  
  <pre><code>@Override
      protected String doInBackground(Void... params) {
          String accountName = Plus.AccountApi.getAccountName(googleApiClient);
          Account account = new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
          //String scopes = "oauth2:profile email";
          String scopes = "audience:server:client_id:" + Service.SERVER_CLIENT_ID; // Not the app's client ID.
          Log.d(TAG, "Account Name: " + accountName);
          Log.d(TAG, "Scopes: " + scopes);
  
          try {
              userIdToken = GoogleAuthUtil.getToken(getApplicationContext(), account, scopes);
  
              return userIdToken;
          } catch (IOException e) {
              Log.e(TAG, "IOError retrieving ID token.", e);
              return null;
          } catch (UserRecoverableAuthException e) {
              startActivityForResult(e.getIntent(), RC_SIGN_IN);
              return null;
          } catch (GoogleAuthException e) {
              Log.e(TAG, "GoogleAuthError retrieving ID token.", e);
              return null;
          }
      }
  </code></pre>