2013-06-19 37 views
0

我正在使用gtm oauth框架對vimeo進行oatuh身份驗證。我的問題是,當我使用GTMO框架,然後我給調用下面的函數來獲得VIMEO視頻JSON值成功獲得訪問令牌,但我得到這個錯誤:如何在vimeo上進行身份驗證

{"generated_in":"0.0046","stat":"fail","err":{"code":"401","expl":"The oauth_signature passed was not valid.","msg":"Invalid signature"}}

Actualy的問題是,當我從得到簽名值auth對象,那麼它們在auth對象中不存在簽名參數。請指導我,我在哪裏做錯了:

- (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]); 

    } 
+0

後回來HI,你找到答案這個。我也有同樣的問題。請幫忙。 – Durgaprasad

回答

0

嗨我可能爲時已晚。 但是你需要附加認證的簽名以及這樣的每一個請求

[signedAuth authorizeRequest:request];

其中signedAuth是GTMOAuthAuthentication實例驗證

相關問題