问题描述
我尝试集成STTwitter框架(Github项目)以与Twitter API 1.1进行交互。
I've tried to integrate the STTwitter framework (Github project) for interacting with the Twitter API 1.1.
在我的开发帐户中创建应用程序后,我已将OAuth凭据用于仅应用程序模式身份验证。无论如何,我得到以下错误,我不知道如何解决它:错误域= STTwitterTwitterErrorDomain代码= 220您的凭据不允许访问此资源
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?
推荐答案
这是因为你没有使用正确的 STTwitterAPI
构造函数。
This is because you didn't use the right STTwitterAPI
constructor.
使用 [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:consumerSecret:]
而不是你的例子可以正常工作。
Use [STTwitterAPI twitterAPIAppOnlyWithConsumerKey:consumerSecret:]
instead and your example will work fine.
这篇关于Twitter API应用程序仅模式身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!