Q:

"Application needs OAuth consent from the User" when saving a weight value to Google Fit

I am creating the GoogleApiClient instance with the following 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();

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:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.i(TAG, "Result received");
    authInProgress = false;
    gf.connect();
}

On the log, I can see the authorization process working, but when trying to save into Google Fit, using the following 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);

I am seeing the following error:

Application needs OAuth consent from the User

What am I missing?  The OAuth credentials have been created in the Google Console. 

A:

You should add more Scope when init mClient:
Example:
mClient = new GoogleApiClient. Builder(act)
    .addApi(Fitness. HISTORY_API)
    .addScope(new Scope(Scopes. FITNESS_ACTIVITY_READ_WRITE))
    .addScope(new Scope(Scopes. FITNESS_NUTRITION_READ))

and more depending on which value you want to get data.