gpt4 book ai didi

ios - 使用 Instapaper API 时,为什么我不断收到 401 错误?

转载 作者:行者123 更新时间:2023-11-29 04:02:39 26 4
gpt4 key购买 nike

我正在尝试使用 full Instapaper API通过AFOAuth2Client library但我不断收到错误代码 401。我不知道我的代码出了什么问题。当我从电子邮件中复制并粘贴它们时,我绝对拥有正确的 ID 和 secret 。

- (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's API docs :

Instapaper’s OAuth implementation is different from what you may be accustomed to: there is no request-token/authorize workflow. This makes it much simpler. Instead, Instapaper uses an implementation of xAuth very similar to Twitter’s. So you still need to sign your requests, but getting tokens is simple.

xAuth is the only way to get an Instapaper access token.

OAuth 2 与 OAuth 1 不同,OAuth 1 本身也与 xAuth 不同。

AFOAuth2Client 在这里不起作用。您可能有幸获得 AFXAuthClientAFOAuth1Client .

关于ios - 使用 Instapaper API 时,为什么我不断收到 401 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15670378/

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