APP_CLIENT_ID 和 SERVER_CLIENT_ID 是什么,我在哪里可以找到它们?
What are APP_CLIENT_ID and SERVER_CLIENT_ID and where do I find them?
我正在尝试为我的 iOS 应用实施服务器端 API 访问。 Google 文档 (here) 在第 2 步的代码示例中提到了 APP_CLIENT_ID
和 SERVER_CLIENT_ID
。
这是他们的代码:
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GIDSignIn sharedInstance].clientID = @"APP_CLIENT_ID";
[GIDSignIn sharedInstance].serverClientID = @"SERVER_CLIENT_ID";
// Additional scopes, if any
// [GIDSignIn sharedInstance].scopes = @[ @"other_scope" ];
return YES;
}
什么是 APP_CLIENT_ID
和 SERVER_CLIENT_ID
,我在哪里可以找到它们?它们都在 Google Developers Console 中吗?
将 APP_CLIENT_ID
字符串替换为 iOS 应用程序的已安装应用程序 OAuth 2.0 客户端 ID,通过添加凭据并选择以下单选按钮进行配置:
SERVER_CLIENT_ID
字符串存储 Web 服务器 OAuth 2.0 客户端 ID,并从控制台配置为:
控制台中 "Client ID for web application" 下列出的服务器客户端 ID 仅在您检索授权代码以在混合授权方案中授权您的服务器时使用,并且是可选的。指定 SERVER_CLIENT_ID
时,您会检索授权代码,并且当您从 iOS 应用程序向用户授权时,可以在后端服务上将该代码交换为刷新令牌。
客户端 ID 传统上是通过 Google Developer Console as described here. However, using the latest libraries, you can generate a configuration and load it as explained in the iOS developer guide for Google Sign-In 配置的。
我正在尝试为我的 iOS 应用实施服务器端 API 访问。 Google 文档 (here) 在第 2 步的代码示例中提到了 APP_CLIENT_ID
和 SERVER_CLIENT_ID
。
这是他们的代码:
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GIDSignIn sharedInstance].clientID = @"APP_CLIENT_ID";
[GIDSignIn sharedInstance].serverClientID = @"SERVER_CLIENT_ID";
// Additional scopes, if any
// [GIDSignIn sharedInstance].scopes = @[ @"other_scope" ];
return YES;
}
什么是 APP_CLIENT_ID
和 SERVER_CLIENT_ID
,我在哪里可以找到它们?它们都在 Google Developers Console 中吗?
将 APP_CLIENT_ID
字符串替换为 iOS 应用程序的已安装应用程序 OAuth 2.0 客户端 ID,通过添加凭据并选择以下单选按钮进行配置:
SERVER_CLIENT_ID
字符串存储 Web 服务器 OAuth 2.0 客户端 ID,并从控制台配置为:
控制台中 "Client ID for web application" 下列出的服务器客户端 ID 仅在您检索授权代码以在混合授权方案中授权您的服务器时使用,并且是可选的。指定 SERVER_CLIENT_ID
时,您会检索授权代码,并且当您从 iOS 应用程序向用户授权时,可以在后端服务上将该代码交换为刷新令牌。
客户端 ID 传统上是通过 Google Developer Console as described here. However, using the latest libraries, you can generate a configuration and load it as explained in the iOS developer guide for Google Sign-In 配置的。