Google Cloud Datastore / Mobile Backend Starter - resolves a crash when updating / updating

Using Android classes for mobile backend servers (MBS) (which were distributed as a sample project when creating a new project in the Google Dev Console and dismantled in Google I / O 2013). I can insert new objects into the cloud data warehouse through calls to CloudBackendMessaging.insertAll or .updateAll. The latter will create objects if they do not exist, so that it is functionally identical to the insert for new records.

Insert / create works great. However, when I try to update existing records in the data warehouse, I received permission errors, for example. (from backend magazine)

Method: mobilebackend.endpointV1.updateAll

Error Code: 401

Reason: required

Message: Adverse permission to update CloudEntity: XXXXXX by: USER: YYYYYYY

which results in matching access errors on the client side of logcat.

In all cases, I use secure access authentication with a valid Google account (my own).

Insertable objects are thus displayed as “owned” by my user ID with “updated” and “created” that displays my Google Account email address.

, , CloudBackendMessenger , , .., , - . , , , ? , , , , ( KindName , [public], [private] ).

-, UPDATES Mobile Backend Starter Datascore, ? .

+4
3

" CloudEntity" cloudBackendAsync.update(cloudEntity). , , cloudEntity . . createdAt , , . . . createdAt . , , createdAt . : .

0

, , CloudEntity insert/update/delete.

    CloudQuery cq = new CloudQuery("datastoretype");
    cq.setLimit(1);
    cq.setFilter(Filter.eq("_id",id));

    cloudEntity.setId(id);
    mProcessingFragment.getCloudBackend().get(cloudEntity, handler);

:

    mProcessingFragment.getCloudBackend().update(cloudEntity, handler);

, .

0

, , , , , . , , google - https://cloud.google.com/cloud/samples/mbs/authentication

Google , CloudBackend # setCredential() ( , CloudBackendAsync CloudBackendMessaging), GoogleAccountCredential .

GoogleAccountCredential credential = GoogleAccountCredential.usingAudience(this, "<Web Client ID>");
credential.setSelectedAccountName("<Google Account Name>");
cloudBackend.setCredential(credential);

credientials , " ", createdBy/updatedBy/owner CloudEntity .

0

Source: https://habr.com/ru/post/1537593/


All Articles