【发布时间】:2015-05-22 17:03:09
【问题描述】:
我正在尝试通过 iOS 应用向 Vimeo 进行身份验证。我正在使用GTMOAuth2Authentication Oauth2 库。我的代码如下:
- (void)signInToVimeo
{
GTMOAuth2Authentication * auth = [self authForVimeo];
GTMOAuth2ViewControllerTouch * viewController =
[[GTMOAuth2ViewControllerTouch alloc] initWithAuthentication:auth
authorizationURL:[NSURL URLWithString:@""]
keychainItemName:@"VimeoKeychainItem"
delegate:self
finishedSelector:@selector(viewController:
finishedWithAuth:error:)];
[self.navigationController pushViewController:viewController animated:YES];
}
- (GTMOAuth2Authentication * )authForVimeo
{
NSURL * tokenURL = [NSURL URLWithString:VIMEO_REQUEST_TOKEN_URL];
NSString * redirectURI = @"vimeoTest://";
GTMOAuth2Authentication * auth;
auth = [GTMOAuth2Authentication
authenticationWithServiceProvider:@"Vimeo"
tokenURL:tokenURL
redirectURI:redirectURI
clientID:CLIENT_ID
clientSecret:SECRET_KEY];
auth.scope = @"edit";
return auth;
}
- (void)viewController:(GTMOAuth2ViewControllerTouch * )viewController
finishedWithAuth:(GTMOAuth2Authentication * )auth
error:(NSError * )error
{
NSLog(@"auth access token: %@", auth.accessToken);
NSLog(@"%@", [error localizedDescription]);
}
我在应用程序和 Vimeo 开发者网站的 URL 方案中设置了相同的回调 URL vimeoTest://。 Vimeo 登录屏幕显示良好,输入登录凭据后要求“允许”或“取消”;没关系,但是当我点击“允许”时,我没有获得带有错误消息“com.google.HTTPStatus 错误 404”的设备令牌。有没有 Vimeo 认证和上传的例子?
【问题讨论】:
标签: ios objective-c authentication oauth vimeo