无法通过在Swift中调用API来获取Google通讯录

我正在尝试将Google日历活动和Google通讯录添加到我的Swift(iOS)应用程序中。 我能够成功登录Google登录并能够获取日历活动。 但是,在尝试获取Google通讯录时,它会抛出403错误,但是,我已经在Google开发者控制台中为我的项目启用了API。

private let scopes = ["https://www.googleapis.com/auth/calendar.readonly","https://www.googleapis.com/auth/plus.login","https://www.googleapis.com/auth/plus.me","https://www.googleapis.com/auth/contacts.readonly"] override func viewDidLoad() { super.viewDidLoad() GIDSignIn.sharedInstance().clientID = kClientID GIDSignIn.sharedInstance().uiDelegate = self GIDSignIn.sharedInstance().scopes = scopes // GIDSignIn.sharedInstance().signIn() GIDSignIn.sharedInstance().delegate = self self.myTableView.isHidden = true self.defaultButton.isHidden = false dataArray.removeAllObjects() self.myTableView.estimatedRowHeight = UITableViewAutomaticDimension self.myTableView.rowHeight = UITableViewAutomaticDimension } func sign(_ signIn: GIDSignIn!, didSignInFor user: GIDGoogleUser!, withError error: Error!) { if (error == nil) { userEmailID = user.profile.email } else { print("\(error.localizedDescription)") } if let error = error { showAlert(title: "Authentication Error", message: error.localizedDescription) self.service.authorizer = nil self.myTableView.isHidden = true self.defaultButton.isHidden = false } else { self.service.authorizer = user.authentication.fetcherAuthorizer() fetchEvents() getPeopleList() self.myTableView.isHidden = false self.defaultButton.isHidden = true self.myTableView.dataSource = self self.myTableView.delegate = self } } func getPeopleList() { if let accessToken = GIDSignIn.sharedInstance().currentUser.authentication.accessToken { let urlString = ("https://www.googleapis.com/plus/v1/people/me/people/visible?access_token=\(accessToken)") // let url = NSURL(string: urlString) print(accessToken) print(urlString) Alamofire.request(urlString).response { response in // method defaults to `.get` debugPrint(response.data) print(response) } } } 

执行此程序后,显示以下错误。

 { Status Code: 403, Headers { "Cache-Control" = ( "private, max-age=0" ); "Content-Encoding" = ( gzip ); "Content-Length" = ( 136 ); "Content-Type" = ( "application/json; charset=UTF-8" ); Date = ( "Tue, 31 Jul 2018 13:35:51 GMT" ); Expires = ( "Tue, 31 Jul 2018 13:35:51 GMT" ); Server = ( GSE ); Vary = ( Origin, "X-Origin" ); "Www-Authenticate" = ( "Bearer realm=\"https://accounts.google.com/\", error=insufficient_scope, scope=\"https://www.googleapis.com/auth/plus.login\"" ); "alt-svc" = ( "quic=\":443\"; ma=2592000; v=\"44,43,39,35\"" ); "x-content-type-options" = ( nosniff ); "x-frame-options" = ( SAMEORIGIN ); "x-xss-protection" = ( "1; mode=block" ); } } 

任何人都可以建议我,我做错了吗?