我一直在使用此集成手册进行服务器端Google登录iOS:https://developers.google.com/+/mobile/ios/getting-started
每当我让用户登录并将id令牌传递给后端服务器时,就会出现此错误:
由于[无法识别的客户端]而导致令牌无效。 ]
我显然已经检查过我的客户端是否设置正确,据我所见,确实如此。我按照下面的惯例做了一切:
GPPSignIn.sharedInstance().clientID = "some_code.apps.googleusercontent.com"
GPPSignIn.sharedInstance().homeServerClientID = "some_code.apps.googleusercontent.com"
GPPSignIn.sharedInstance().scopes = [kGTLAuthScopePlusLogin]
GPPSignIn.sharedInstance().delegate = self
GPPSignIn.sharedInstance().authenticate()
func finishedWithAuth(auth: GTMOAuth2Authentication!, error: NSError!) {
sendPOSTRequest("https://url", params: "idToken=" + GPPSignIn.sharedInstance().idToken)
}
func application(application: UIApplication,
openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return GPPSignIn.sharedInstance().handleURL(url,
sourceApplication: sourceApplication,
annotation: annotation)
}
我已经在标识符和网址方案字段中添加了我的包ID的网址类型。
我甚至沿着GIDSignIn路线走了同样的结果。