我正在尝试通过 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)。我错过了什么吗?(缺少参数?)