我正在使用gtm oauth 框架对 vimeo 进行 oatuh 身份验证。我的问题是当我使用 gtmo 框架成功获取访问令牌时,然后我调用下面的函数来获取 vimeo 的视频 json 值,但我收到此错误:
{"generated_in":"0.0046","stat":"fail","err":{"code":"401","expl":"传递的 oauth_signature 无效。","msg":"无效签名”}}
实际上,问题是当我从身份验证对象获取签名值时,身份验证对象中不存在签名参数。请指导我在哪里做错:
- (void) fetchNetwork:(GTMOAuthAuthentication *)auth
{
NSLog(@"auth access token %@",auth.accessToken);
NSLog(@"auth access token %@",auth.token);
NSLog(@"auth consumer key %@",auth.consumerKey);
NSLog(@"auth token%@",auth.token);
NSLog(@"realm %@",auth.realm);
NSLog(@"auth version %@",auth.version);
NSLog(@"auth signature method %@",auth.signatureMethod);
NSLog(@"auth time stamp%@",auth.timestamp);
NSLog(@"auth nonce %@",auth.nonce);
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.search&oauth_consumer_key=%@&oauth_nonce=%@&oauth_signature_method=%@&oauth_timestamp=%@&oauth_version=%@&oauth_signature=%@&query=amirkhan",auth.consumerKey,auth.nonce,auth.signatureMethod,auth.timestamp,auth.version,@""]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"GET"];
NSLog(@"response string:%@",request);
NSHTTPURLResponse* urlResponse = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:nil];
NSLog(@"response string:%@",responseData);
NSString *strResponse = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"response string:%@",strResponse);
NSLog(@"Response Code: %d", [urlResponse statusCode]);
}