0

I'm using the iOS DataStore API to upload data to StackMob. I get this error when I try to use my smclient initialized with my public key.

HTTP Code=401 "The operation couldn’t be completed. (HTTP error 401.)" UserInfo=0xa14dac0 {error=Insufficient authorization}

Sample code

[[self.smclient dataStore] createObject:eventDictObj
                                          inSchema:@"EventSchema"
                                         onSuccess:^(NSDictionary *object, NSString *schema)
                                            {
                                                NSLog(@"Created online event : %@", object);
                                                successBlock();
                                            }
                                         onFailure:^(NSError *error, NSDictionary* object, NSString *schema)
                                            {
                                                failedBlock(error);
                                            }];

And smclient is initialized as follows

self.smclient = [[SMClient alloc] initWithAPIVersion:@"0" publicKey:@"xxxxxxxxxx"];

For this use case I don't need to use the logged in user credentials to create this entry in StackMob

ArdenDev
  • 4,051
  • 5
  • 29
  • 50

1 Answers1

0

Make sure that the permissions are set to Open on your stack mob database.

ssdscott
  • 683
  • 6
  • 12