Ios 在使用Instapaper API时,为什么我会不断收到401个错误?

Ios 在使用Instapaper API时,为什么我会不断收到401个错误?,ios,objective-c,api,afnetworking,instapaper,Ios,Objective C,Api,Afnetworking,Instapaper,我试图通过使用,但我一直得到错误代码401。我不知道我的代码出了什么问题。当我从电子邮件中复制并粘贴它们时,我肯定拥有正确的ID和秘密 - (IBAction)loginPressed:(UIButton *)sender { NSURL *baseURL = [NSURL URLWithString:@"https://www.instapaper.com/"]; AFOAuth2Client *OAuthClient = [AFOAuth2Client clientWith

我试图通过使用,但我一直得到错误代码401。我不知道我的代码出了什么问题。当我从电子邮件中复制并粘贴它们时,我肯定拥有正确的ID和秘密

- (IBAction)loginPressed:(UIButton *)sender {
    NSURL *baseURL = [NSURL URLWithString:@"https://www.instapaper.com/"];

    AFOAuth2Client *OAuthClient = [AFOAuth2Client clientWithBaseURL:baseURL
                                                  clientID:@"fromEmail"
                                                  secret:@"fromEmail"];

    NSDictionary *parameters = @{
        @"x_auth_username:" : self.usernameField.text,
        @"x_auth_password:" : self.passwordField.text,
        @"x_auth_mode:" : @"client_auth"
    };

    [OAuthClient authenticateUsingOAuthWithPath:@"api/1/oauth/access_token"
                 parameters:parameters
                 success:^(AFOAuthCredential *credential) {
                     NSLog(@"I has token! %@", credential.accessToken);
                     // [AFOAuthCredential storeCredential:credential withIdentifier:OAuthClient.serviceProviderIdentifier];
                 }
                 failure:^(NSError *error) {
                     NSLog(@"Sheet. %@", [error localizedDescription]);
                 }];
}
根据:

Instapaper的OAuth实现与您可能习惯的不同:没有请求令牌/授权工作流。这使它简单得多。相反,Instapaper使用了与Twitter非常相似的xAuth实现。因此,您仍然需要对请求进行签名,但获取令牌很简单

xAuth是获取Instapaper访问令牌的唯一途径。

OAuth 2不同于OAuth 1,OAuth 1本身也不同于xAuth


AFOAuth2Client
在这里不起作用。您可能会很幸运使用或。

您能否向我们展示故障块的NSLog输出,如果这是正在运行的内容?啊,谢谢mattt(顺便说一下,我非常感谢您的项目)。相当恼人的Marco决定在URL方案中选择
oauth
,如果它是xauth。那个图书馆运作得很好。非常感谢。