我试图通过提供以下范围来实现谷歌登录并获取个人资料详细信息以及联系人列表
NSString *driveScope = @"https://www.googleapis.com/auth/plus.login";
NSString *driveScope2 = @"https://www.googleapis.com/auth/plus.me";
NSArray *currentScopes = [GIDSignIn sharedInstance].scopes;
[GIDSignIn sharedInstance].scopes = [currentScopes arrayByAddingObject:driveScope];
[GIDSignIn sharedInstance].scopes = [currentScopes arrayByAddingObject:driveScope2];
[[GIDSignIn sharedInstance] signIn];
身份验证后,已获取用户信息,但要获取用户联系人,使用以下 API:
-(void) fetchUserContacts
{
self.url = [NSString stringWithFormat:@"https://www.googleapis.com/plus/v1/people/me/people/visible?access_token=%@",GIDSignIn.sharedInstance.currentUser.authentication.accessToken];
HttpRequest *request = [[HttpRequest alloc] init];
request.delegate = self;
[request makeRequestWithURL:self.url andHttpKey:@"Contacts"];
}
但回应是:
**error = {
code = 401;
errors = (
{
domain = global;
location = Authorization;
locationType = header;
message = "Invalid Credentials";
reason = authError;
}
);
message = "Invalid Credentials";
}**
请帮我解决这个问题。提前致谢。