Exception when changing the level of access to recording in the form of a bucket using the Kii Cloud SDK

I am testing the Kii Cloud mobile server as a service (MBaaS) in an Android application. I am trying to create an object at the application level before user authentication occurs. To do this, I want to change the application bucket so that anonymous users can write it:

Kii.initialize("my_app_id", "my_app_key", Kii.Site.US); KiiBucket bucket = Kii.bucket("app_status"); KiiACL ubACL = bucket.acl(); ubACL.putACLEntry(new KiiACLEntry(KiiAnonymousUser.create(), KiiACL.BucketAction.CREATE_OBJECTS_IN_BUCKET, true)); ubACL.save(new KiiACLCallBack() { @Override public void onSaveCompleted(int token, KiiACL acl, Exception exception) { if (exception != null) Toast.makeText(getInstance().getApplicationContext(), exception.toString(), Toast.LENGTH_LONG); } }); 

But I always get an exception when trying to save an ACL (onSaveCompleted () returns with an exception):

 com.kii.cloud.storage.exception.ACLOperationException: Error: null HTTP Response Status: 403 HTTP Response Body: { "errorCode" : "WRONG_TOKEN", "message" : "The provided token is not valid", "appID" : "bc4100c0", "accessToken" : "null", "suppressed" : [ ] } 

I pass my app_id and app_key correctly at the beginning (first line of example code). Any ideas what might cause this error? Thank you in advance for your reply.

+4
source share
2 answers

Try replacing

 KiiAnonymousUser.create() 

with

 new KiiAnonymousUser() 

It seems the static create () method has been removed.

The best

+2
source

Answering my question. My code snippet is likely to throw exceptions, since user access control via ACL can only be applied to group and user level codes (and not to application level levels)

0
source

All Articles