Google OAuth2 的客户端机密到底是什么?

What exactly is the client secret for Google OAuth2?

Google's OIDC guide 中,Exchange code for access token and ID token 部分声明我必须提供 client_secret.

如果我从 API 控制台 select 相关的客户端 ID,我确实会得到一个名为 client_secret_... 的 JSON 文件。但是,JSON 对象的 none 字段被命名为 secret 或类似的名称。 (字段名为 client_idproject_idauth_uritoken_uriauth_provider_x509_cert_urlredirect_uris。)

那么,我从哪里得到这个 client_secret

我认为秘密曾经在文件中,但您也可以通过查看下载 json 文件的页面找到它,您也可以单击按钮重置所述秘密。

我会确保正在查看的凭据在 OAuth 2.0 client IDs 而不是 Service account keysAPI keys 下,我相信只有第一个需要一个秘密。

来自评论的更新: 为 android 创建 Oauth 客户端 ID 不会给你一个秘密,因为它在 android 应用程序中不需要,应该是正在关注 Add google sign-in to your android App