gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:59:42 30 4
gpt4 key购买 nike

我正在使用 google-api-nodejs-client获取个人资料信息并使用 Google 登录。我希望 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 和网络/服务器客户端 ID 没有匹配的项目编号。客户端 ID 设置如下:

${PROJECT_NUMBER}-${ID_HASH}.apps.googleusercontent.com

解决此问题的一种方法是重新创建客户端 ID。

关于ios - 服务器应如何代表 iOS 用户进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25731490/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com