GIDSignIn错误代码401

时间:2017-05-12 11:01:11

标签: objective-c http-status-code-401 gidsignin

我试图通过提供以下范围来实施Google登录并通过联系人列表获取个人资料详情

<div>
    <div ng-if="type===1">Input : <input type="text"></div>
    <div ng-if="type===2">Input : <input type="textarea"></div>
</div>

验证后,已获取用户信息,但使用以下API获取用户联系人:

    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];

但回复是:

-(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"];
}

} **

请帮我解决此问题。提前谢谢。

0 个答案:

没有答案