我試圖通過AFOAuth2Client library使用full Instapaper API,但我不斷收到錯誤代碼401.我不知道我的代碼有什麼問題。當我複製並粘貼電子郵件時,我肯定沒有正確的ID和祕密。當使用Instapaper API時,爲什麼我不斷收到401錯誤?
- (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]);
}];
}
你能告訴我們失敗塊的NSLog輸出,如果這是什麼運行? – charleyh 2013-05-26 14:57:07