我正在尝试通过AFOAuth2Client(AFNetworking扩展程序)登录Google +。 我写了这段代码:
NSURL *url = [NSURL URLWithString:@"https://accounts.google.com/"];
AFOAuth2Client *oauthClient = [AFOAuth2Client clientWithBaseURL:url clientID:@"MY_ID" secret:@"MY_SECRET"];
[oauthClient authenticateUsingOAuthWithPath:@"/o/oauth2/token"
parameters:@{@"scope": @"https://www.googleapis.com/auth/plus.me", @"response_type" : @"code", @"redirect_uri" : @"https://www.domain.com/oauth2callback"}
success:^(AFOAuthCredential *credential) {
NSLog(@"I have a token! %@", credential.accessToken);
} failure:^(NSError *error) {
NSLog(@"Error: %@", error);
}];
但是使用invalid_request调用错误块(错误400)。 我错过了什么吗? (缺少参数?)