我正在开发一个iOS应用,需要将数据发送到我正在开发的谷歌应用引擎服务器应用。 iOS应用程序的每个用户都将使用他们的Google身份访问应用程序的服务器部分。我正在尝试使用漂亮的gtm-oauth library。为了获得我的OAuth使用者密钥和OAuth消费者密钥,我使用了Google的服务register my domain。从iOS设备到谷歌应用引擎的Oauth用户认证
当我创建用于访问Google联系人列表的代码时,它可以正常工作,但我无法使其与我的应用程序引擎应用程序协同工作。当我尝试时,在验证控制器视图中出现错误“您请求的服务尚未可用,请在30秒内再试一次”。在应用引擎控制台中,我看到/ _ah/OAuthGetAccessToken失败的请求(我没有提供任何此路径)。
这里是我的代码:我使用的是正确的网址
-(IBAction)authButtonClicked: (id) sender {
[GTMHTTPFetcher setLoggingEnabled:YES];
NSURL *requestURL = [NSURL URLWithString:@"https://mysite.appspot.com/_ah/OAuthGetRequestToken"];
NSURL *accessURL = [NSURL URLWithString:@"https:/mysite.appspot.com/_ah/OAuthAuthorizeToken"];
NSURL *authorizeURL = [NSURL URLWithString:@"https://mysite.appspot.com/_ah/OAuthGetAccessToken"];
NSString *scope = @"http://mysite.appspot.com/";
GTMOAuthAuthentication *auth = [self myCustomAuth];
GTMOAuthViewControllerTouch *viewController;
viewController = [[GTMOAuthViewControllerTouch alloc] initWithScope:scope
language:nil
requestTokenURL:requestURL
authorizeTokenURL:authorizeURL
accessTokenURL:accessURL
authentication:auth
appServiceName:@"My Service"
delegate:self
finishedSelector:@selector(viewController:finishedWithAuth:error:)];
[[self navigationController] pushViewController:viewController animated:YES];
}
- (GTMOAuthAuthentication *)myCustomAuth {
NSString *myConsumerKey = @"mysite.appspot.com"; // from google registration
NSString *myConsumerSecret = @"xxxxxxxxxxxxxxx"; // from google registration
GTMOAuthAuthentication *auth;
auth = [[GTMOAuthAuthentication alloc] initWithSignatureMethod:kGTMOAuthSignatureMethodHMAC_SHA1
consumerKey:myConsumerKey
privateKey:myConsumerSecret];
auth.serviceProvider = @"Custom Auth Service";
return auth;
}
是谁?范围是否正确?什么会导致该消息?