title: "Application needs OAuth consent from the User" when saving a weight value to Google Fit
body: <p>I am creating the GoogleApiClient instance with the following code:</p>
  
  <pre><code>    // Create the Google API Client
      mClient = new GoogleApiClient.Builder(act)
          .addApi(Fitness.HISTORY_API)
          .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
          .addConnectionCallbacks(this)
          .enableAutoManage(act, 0, this)
          .build();
  </code></pre>
  
  <p>When the client is created, the phone shows the account selection dialog and then the OAuth authorization dialog. After that, the activity gets the result on the following method:</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      Log.i(TAG, "Result received");
      authInProgress = false;
      gf.connect();
  }
  </code></pre>
  
  <p>On the log, I can see the authorization process working, but when trying to save into Google Fit, using the following code:</p>
  
  <pre><code>    Calendar calendar = Calendar.getInstance();
      Date now = new Date();
      calendar.setTime(now);
      long date = calendar.getTimeInMillis();
  
      DataSource dataSource = new DataSource.Builder().
              setAppPackageName(activity).
              setDataType(dataType).
              setType(DataSource.TYPE_RAW).
              build();
      DataSet dataSet = DataSet.create(dataSource);
      DataPoint dataPoint = dataSet.
              createDataPoint().
              setTimestamp(date, TimeUnit.MILLISECONDS);
      dataPoint.
              getValue(field).
              setFloat(value);
      dataSet.add(dataPoint);
  
      Fitness.HistoryApi.insertData(mClient, dataSet).setResultCallback(cb);
  </code></pre>
  
  <p>I am seeing the following error:</p>
  
  <blockquote>
    <p>Application needs OAuth consent from the User</p>
  </blockquote>
  
  <p>What am I missing? The OAuth credentials have been created in the Google Console.</p>