0

我正在使用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]);

    }
4

1 回答 1

0

嗨,我可能来不及回复了。但是您需要将经过身份验证的签名与这样的每个请求一起附加

[签名授权授权请求:请求];

其中 signedAuth 是 GTMOAuthAuthentication 在身份验证后返回的实例

于 2013-10-16T11:38:37.930 回答