服务器应如何代表iOS用户进行身份验证?

服务器应如何代表iOS用户进行身份验证?,ios,node.js,google-oauth,Ios,Node.js,Google Oauth,我用它来获取个人资料信息和登录谷歌。我希望iOS客户端通过我的服务器登录到Google - (void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error { if (error) { NSLog(@"Error: %@", error); abort(); } else { NSString *serverCode = [GPPSignI

我用它来获取个人资料信息和登录谷歌。我希望iOS客户端通过我的服务器登录到Google

- (void)finishedWithAuth:(GTMOAuth2Authentication *)auth error:(NSError *)error {
    if (error) {
        NSLog(@"Error: %@", error);

        abort();
    } else {
        NSString *serverCode = [GPPSignIn sharedInstance].homeServerAuthorizationCode;
        NSURLRequest * urlRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:1337/auth/google/callback?code=%@",serverCode]]];
        NSURLResponse * response = nil;
        NSError * error = nil;
        [NSURLConnection sendSynchronousRequest:urlRequest
                                              returningResponse:&response
                                                          error:&error];
        NSLog(@"%@, %@",[response description], serverCode);


        [self refreshInterface];
    }
}
finishedWithAuth:
返回以下错误:

json={
    error = "invalid_audience";
    "error_description" = "The audience client and the client need to be in the same project.";
}}
什么是受众?我们如何将客户机ID添加到服务器


谢谢

这意味着您的iOS客户端ID和web/服务器客户端ID没有匹配的项目编号。客户端ID的设置如下所示:

${PROJECT_NUMBER}-${ID_HASH}.apps.googleusercontent.com
解决此问题的一种方法是重新创建客户端ID