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.
source share