我试图获取Picasa的请求令牌以离线访问相册和相片。我能够使用这两个参数(access_type和approval_prompt)从服务器端请求它,但我不知道如何将它们传递给iPhone客户端(GTMOAuth2Authentication和GTMOAuth2ViewControllerTouch)。
ACCESS_TYPE =离线&安培; approval_prompt =力"
非常感谢任何帮助。
谢谢!
答案 0 :(得分:0)
找到答案。在发出请求之前,您可以在GTMOAuth2SignIn additionalAuthorizationParameters属性中设置参数。
GTMOAuth2ViewControllerTouch *viewController;
[[viewController signIn] setAdditionalAuthorizationParameters:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"offline",@"force", nil] forKeys:[NSArray arrayWithObjects:@"access_type",@"approval_prompt", nil]]];
答案 1 :(得分:0)
-(void)showGoogleLoginPage{
SEL finishedSelector = @selector(viewController:finishedWithAuth:error:);
GTMOAuth2ViewControllerTouch *authViewController =
[[GTMOAuth2ViewControllerTouch alloc] initWithScope:kGTLAuthScopeDrive
clientID:kClientID
clientSecret:kClientSecret
keychainItemName:userKeyChainName
delegate:self
finishedSelector:finishedSelector];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjects:[NSArray
arrayWithObjects:@"offline",@"force",@"en", nil] forKeys:[NSArray arrayWithObjects:@"access_type",@"approval_prompt",@"hl", nil]];
authViewController.signIn.shouldFetchGoogleUserProfile = YES;
authViewController.signIn.additionalAuthorizationParameters=params;
[self presentViewController:authViewController animated:YES completion:nil];
}
希望对你有所帮助..