当我使用以下代码时,收到消息“无法验证oauth签名和令牌”
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.twitter.com/oauth/access_token"]];
[request setHTTPMethod:@"POST"];
NSString *postString = @"oauth_consumer_key=My Consumer key&oauth_signature_method=HMAC-SHA1&oauth_signature=My Consumer secret&oauth_timestamp=?????&oauth_nonce=?????oauth_version=1.0&x_auth_username=My Twitter ID&x_auth_password=My Twitter password&x_auth_mode=client_auth";
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSHTTPURLResponse *response = NULL;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
NSString *responseDataString = [[NSString alloc] initWithData:responseData encoding:NSASCIIStringEncoding];
NSLog(@"Response from Twitter: %@", responseDataString);
所以,我想知道请求内容的确切配置 使用的帖子数据如下。我的应用程序有能力使用xAuth
oauth_consumer_key =我的消费者密钥
oauth_signature_method = HMAC-SHA1
oauth_signature =我的消费者秘密
oauth_timestamp = ?????
oauth_nonce = ?????
oauth_version = 1.0
x_auth_username =我的Twitter ID
x_auth_password =我的Twitter密码
x_auth_mode = client_auth