Twitter API application only mode authentication
Asked Answered
C

2

0

I've tried to integrate the STTwitter framework (Github project) for interacting with the Twitter API 1.1.

After I've create an app in my dev account, I've used the OAuth credentials for application only mode authentication. Anyway, I get the following error and I don't know how to fix it: Error Domain=STTwitterTwitterErrorDomain Code=220 "Your credentials do not allow access to this resource"

STTwitterAPI *twitter = [STTwitterAPI twitterAPIWithOAuthConsumerKey:@"XXX"
                                             consumerSecret:@"XXX"];
[twitter verifyCredentialsWithSuccessBlock:^(NSString *bearerToken) {

    NSLog(@"Access granted with %@", bearerToken);


} errorBlock:^(NSError *error) {
    NSLog(@"-- error %@", error);
}];

Does anyone have a clue how to fix it?

Calamity answered 5/6, 2014 at 8:2 Comment(0)
B
0

This is because you didn't use the right STTwitterAPI constructor.

Use [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:consumerSecret:] instead and your example will work fine.

Bathsheba answered 6/6, 2014 at 13:27 Comment(3)
even though i got EXC_BAD_ACCESS ERROR showing ...Please Help meDiaspora
@iOS_Ramesh please post your code and the expected resultBathsheba
#29095801Diaspora
F
1

I got the same problem. However it was caused by the Twitter account on the device not being setup properly - the password field was empty. After I've fixed that I could communicate with Twitter without a problem!

Fovea answered 8/11, 2014 at 19:43 Comment(1)
You are perfectly right. This is also a valid answer. For me, in Settings -> Twitter I could see that twitter account is setup, but when I selected that account, the password was not set. After setting password, everything is working fine.Redeemable
B
0

This is because you didn't use the right STTwitterAPI constructor.

Use [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:consumerSecret:] instead and your example will work fine.

Bathsheba answered 6/6, 2014 at 13:27 Comment(3)
even though i got EXC_BAD_ACCESS ERROR showing ...Please Help meDiaspora
@iOS_Ramesh please post your code and the expected resultBathsheba
#29095801Diaspora

© 2022 - 2024 — McMap. All rights reserved.