gpt4 book ai didi

twitter - 错误代码 220 - "Your credentials do not allow access to this resource"尝试转发时

转载 作者:行者123 更新时间:2023-12-02 12:03:05 24 4
gpt4 key购买 nike

当我尝试获取https://api.twitter.com/1.1/statuses/retweets/21947795900469248.json时使用我的授权凭证(oauth),我得到:

{
"errors": [
{
"message": "Your credentials do not allow access to this resource",
"code": 220
}
]
}

错误:任何其他 twit ID 均无效。这个端点有问题吗?因为直到昨天我才得到真实的回应。有什么变化吗?

最佳答案

我遇到了同样的问题,错误代码为 220。我的解决方法是提示用户再次输入 Twitter 密码。

检查下面的示例代码:

SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeTwitter
requestMethod:SLRequestMethodPOST
URL:[NSURL URLWithString:@"https://api.twitter.com/1.1/statuses/update.json"]
parameters:@{@"status": tweetString}];

[request setAccount:account];
[request performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {

if ([responseData isKindOfClass:[NSData class]]) {

NSError *jsonError = nil;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonError];

if (json) {
NSArray *errors = json[@"errors"];
if (errors.count) {

NSUInteger errorCode = [json[@"errors"][0][@"code"] integerValue];
if (errorCode == 220) {

ACAccountStore *accountStore = [[ACAccountStore alloc] init];
[accountStore renewCredentialsForAccount:account completion:^(ACAccountCredentialRenewResult renewResult, NSError *error2) {
NSLog(@"Renew result: %ld, error: %@", (long)renewResult, error2);

if (renewResult == ACAccountCredentialRenewResultRenewed) {
[self __makeTweetWithAccounts:@[account] rating:rating review:review];
}
}];
}
}
}
}
NSLog(@"Twitter response data: %@", [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
}];

关于twitter - 错误代码 220 - "Your credentials do not allow access to this resource"尝试转发时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23356156/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com