什么是APP_CLIENT_ID和SERVER_CLIENT_ID,在哪里可以找到它们? [英] What are APP_CLIENT_ID and SERVER_CLIENT_ID and where do I find them?

查看:569
本文介绍了什么是APP_CLIENT_ID和SERVER_CLIENT_ID,在哪里可以找到它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的iOS应用实现服务器端API访问. Google文档(此处)提到APP_CLIENT_ID在第2步的代码示例中.

I'm trying to implement server-side API access for my iOS app. The Google docs (here) mention APP_CLIENT_ID and SERVER_CLIENT_ID in their code sample in step 2.

这是他们的代码:

- (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_IDSERVER_CLIENT_ID,在哪里可以找到它们?他们都在Google Developers Console中吗?

What are APP_CLIENT_ID and SERVER_CLIENT_ID and where do I find them? Are they both in the Google Developers Console?

推荐答案

APP_CLIENT_ID字符串替换为iOS应用程序的已安装应用程序OAuth 2.0客户端ID,通过添加凭据并选择以下单选按钮进行配置:

Replace the APP_CLIENT_ID string with an installed application OAuth 2.0 Client ID for the iOS app, configured by adding credentials with the following radio selected:

SERVER_CLIENT_ID字符串存储Web服务器OAuth 2.0客户端ID,并在控制台中配置为:

The SERVER_CLIENT_ID string stores a Web server OAuth 2.0 Client ID and is configured from the console as:

服务器客户端ID(在控制台的"Web应用程序的客户端ID"下列出)仅在以下情况下使用:在混合授权方案中检索授权代码以授权服务器时,该服务器客户端ID是可选的.指定SERVER_CLIENT_ID时,您将检索授权代码,并可以在通过iOS应用授权用户时在后端服务上将代码交换为刷新令牌.

The server client ID, listed under "Client ID for web application" in the console, is only used if you retrieve an authorization code to authorize your server in hybrid authorization scenarios and is optional. When specifying a SERVER_CLIENT_ID, you retrieve an authorization code and can exchange the code for a refresh token on your backend services when you authorize the user from the iOS app.

传统上,客户端ID是通过 Google Developer Console 配置为生成配置并按照 iOS开发者指南(适用于Google登录).

The client IDs traditionally have been configured via the 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.

这篇关于什么是APP_CLIENT_ID和SERVER_CLIENT_ID,在哪里可以找到它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆