Ios 使用xAuth登录到vimeo

Ios 使用xAuth登录到vimeo,ios,api,oauth,vimeo,xauth,Ios,Api,Oauth,Vimeo,Xauth,我尝试在我的应用程序中登录到vimeo上传视频,我在vimeo上创建的应用程序已获得批准 上传访问 已批准用于以下帐户:您的帐户 我使用AFNetworking和AFOAuth1Client(),但也尝试了AFXAuthClient() 使用具有以下代码的Auth1Client: self.vimeoClient = [[AFOAuth1Client alloc] initWithBaseURL:[NSURL URLWithString:vimeoBaseUrl]

我尝试在我的应用程序中登录到vimeo上传视频,我在vimeo上创建的应用程序已获得批准

上传访问

已批准用于以下帐户:您的帐户

我使用AFNetworking和AFOAuth1Client(),但也尝试了AFXAuthClient()

使用具有以下代码的Auth1Client:

self.vimeoClient = [[AFOAuth1Client alloc] initWithBaseURL:[NSURL URLWithString:vimeoBaseUrl]
                                                       key:@"ClientIDHere"
                                                    secret:@"SecretHere"];
[self.vimeoClient postPath:@"/oauth/access_token"
                parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"client_auth",@"x_auth_mode",@"myEmail",@"x_auth_username",@"myPwd",@"x_auth_password",@"write",@"x_auth_permission", nil]
                   success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"...");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@":%@", error.description);
}];
//update begin
AFXAuthToken *token = [[AFXAuthToken alloc] initWithKey:@"Access token from vimeo" secret:@"Access token secret"];
[self.vimeoXClient setToken:token];
//update end

self.vimeoXClient = [[AFXAuthClient alloc] initWithBaseURL:[NSURL URLWithString:vimeoBaseUrl] 
key:@"ClientIDHere" 
secret:@"SecretHere"];
[self.vimeoXClient authorizeUsingXAuthWithAccessTokenPath:@"/oauth/access_token"
                                             accessMethod:@"POST"
                                                 username: @"myEmail"
                                                 password: @"myPwd"
                                                  success:^(AFXAuthToken *accessToken) {
                                                      NSLog(@"...");
                                                  }
                                                  failure:^(NSError *error) {
                                                      NSLog(@"error: %@", error.description);

                                                  }];
我得到这个错误:

VimeoTest[49559:c07]:错误域=AFNetworkingErrorDomain代码=-1011 “预期状态代码在(200-299)中,得到401”UserInfo=0x75622d0 {NSLocalizedRecoverySuggestion=401未经授权-签名无效- 传递的oauth_签名无效。, AFNetworkingOperationFailingURLRequestErrorKey=https://vimeo.com/oauth/access_token>, NSErrorFailingURLKey=, NSLocalizedDescription=预期状态代码为(200-299),获得401, AFNetworkingOperationFailingURLResponseErrorKey=}

使用带有以下代码的AFXAuthClient:

self.vimeoClient = [[AFOAuth1Client alloc] initWithBaseURL:[NSURL URLWithString:vimeoBaseUrl]
                                                       key:@"ClientIDHere"
                                                    secret:@"SecretHere"];
[self.vimeoClient postPath:@"/oauth/access_token"
                parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"client_auth",@"x_auth_mode",@"myEmail",@"x_auth_username",@"myPwd",@"x_auth_password",@"write",@"x_auth_permission", nil]
                   success:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"...");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@":%@", error.description);
}];
//update begin
AFXAuthToken *token = [[AFXAuthToken alloc] initWithKey:@"Access token from vimeo" secret:@"Access token secret"];
[self.vimeoXClient setToken:token];
//update end

self.vimeoXClient = [[AFXAuthClient alloc] initWithBaseURL:[NSURL URLWithString:vimeoBaseUrl] 
key:@"ClientIDHere" 
secret:@"SecretHere"];
[self.vimeoXClient authorizeUsingXAuthWithAccessTokenPath:@"/oauth/access_token"
                                             accessMethod:@"POST"
                                                 username: @"myEmail"
                                                 password: @"myPwd"
                                                  success:^(AFXAuthToken *accessToken) {
                                                      NSLog(@"...");
                                                  }
                                                  failure:^(NSError *error) {
                                                      NSLog(@"error: %@", error.description);

                                                  }];
我得到这个错误:

2013-07-16 20:18:27.819 VimeoTest[49680:c07]错误:错误 域=AFNetworkingErrorDomain代码=-1011“中的预期状态代码 (200-299),获得400“用户信息=0x7223e80 {nsLocalizedRecoverysSuggestion=400错误请求-缺少必需的请求 参数-缺少必需的参数:oauth_令牌。, AFNetworkingOperationFailingURLRequestErrorKey=https://vimeo.com/oauth/access_token>, NSErrorFailingURLKey=, NSLocalizedDescription=预期状态代码为(200-299),获得400, AFNetworkingOperationFailingURLResponseErrorKey=}

更新代码后出错(设置令牌):

2013-07-16 21:20:14.060 VimeoTest[52437:c07]错误:错误 域=AFNetworkingErrorDomain代码=-1011“中的预期状态代码 (200-299),获得401“用户信息=0x8b245a0 {NSLocalizedRecoverySuggestion=401未经授权-权限被拒绝- 传递的oauth_令牌无效或已过期。, AFNetworkingOperationFailingURLRequestErrorKey=https://vimeo.com/oauth/access_token>, NSErrorFailingURLKey=, NSLocalizedDescription=预期状态代码为(200-299),获得401, AFNetworkingOperationFailingURLResponseErrorKey=}

有人知道我做错了什么吗

---更新---

我使用Runscope发送以下参数

Accept: */*
Accept-Encoding: gzip, deflate, compress
Authorization: OAuth oauth_nonce="63129149524659229601374074093", oauth_timestamp="1374074093", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="MYCONSUMERKEYHERE", oauth_token="MYAPPTOKENHERE", oauth_callback="None", oauth_verifier="None", oauth_signature="lW%2BQYzwCcaDzSgoZUtvpSgLRSF4%3D"
Connection: close
Content-Length: 0
Host: vimeo-com-bbmyq45awg44.runscope.net
User-Agent: runscope/0.1
X-Forwarded-For: 54.236.210.241
X-Forwarded-Protocol: https
X-Forwarded-Ssl: on
X-Real-Ip: 54.236.210.241
X_auth_mode: client_auth
X_auth_password: MYPWDHERE
X_auth_permission: write
X_auth_username: MYUSERNAMEHERE
我仍然得到同样的回答

HEADERS

Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, PATCH, DELETE, OPTIONS, HEAD
Access-Control-Allow-Origin: *
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection: close
Content-Length: 104
Content-Type: text/plain;charset=UTF-8
Date: Wed, 17 Jul 2013 15:14:53 GMT
Expires: Wed, 17 Jul 2013 03:14:53 GMT
Runscope-Message-Id: 7bd9d07d-d043-4486-9a19-c3572997d3e4
Server: Apache
Vary: Accept-Encoding
X-Dns-Prefetch-Control: on
X-Powered-By: PHP/5.4.14
BODY view raw

401 Unauthorized - Permission Denied - The oauth_token passed was either not valid or has expired.
我真的不确定我是否错过了一些情人。是否需要oauth_验证器或oauth_回调? 在我的vimeo应用程序设置中,我得到以下信息:

您的回调URL(编辑)vimeoTest://success


我有一个类似的问题,我必须手动将oauth_回调参数添加到请求中。如果您有一个桌面应用程序,但不会使用它,请将其设置为oob。

我遇到了类似的问题,我必须手动将oauth_回调参数添加到请求中。如果您有一个桌面应用程序,但不会使用它,请将其设置为oob。

如果您成功接收到消息“传递的oauth_令牌无效或已过期”,则我认为您正确发送了请求。您可以使用验证是否成功设置了所有标头和参数。如果发送了所有正确的头,Vimeo能够验证您使用的令牌。您可以通过他们的联系方式联系他们。如果您成功接收到消息“传递的oauth_令牌无效或已过期”,则我认为您正确发送了请求。您可以使用验证是否成功设置了所有标头和参数。如果发送了所有正确的头,Vimeo能够验证您使用的令牌。你可以通过他们的网站联系他们。