Google API 控制台 - 缺少客户端密码 [英] Google APIs Console - missing client secret

查看:54
本文介绍了Google API 控制台 - 缺少客户端密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试为使用 OAUTH 2.0 作为登录名以检索用户配置文件的 Android 应用创建测试客户端 ID.我按照步骤在 google 控制台上完成了客户端 ID 的创建,但我在任何地方都没有看到客户端机密.我正在尝试帮助我的雇主为其应用程序获取谷歌凭据.我知道如何在 android 中实现 OAUTH 2.0,但我需要客户端密钥来与访问令牌交换代码.

I tried to create a testing client id for an android app which uses OAUTH 2.0 as login for retrieving user profile. I followed the steps to complete the creation of the client id on google console, but I do not see anywhere the client secret. I'm trying to help my employer with getting google credentials for it's app. I know how to implement OAUTH 2.0 in android, but I need client secret to exchange the code with access token.

首先,我从服务"标签中选择了Google+ API".然后按照 API Access 选项卡中的屏幕步骤操作.

First, I selected "Google+ API" from Services tab. Then followed the on screen steps from API Access tab.

推荐答案

Google 似乎终于抛弃了不必要的client_secret 用于可安装的应用程序 并且尚未更新其文档.您应该检查您是否已经在初始 OAuth 请求中获得了 access_token 就像在 Facebook 上处理的一样.

It seems that Google finally ditched the unnecessary client_secret for installable applications and is not yet up-to-date with their documentation. You should check if you already get an access_token in the initial OAuth request like it's handled on Facebook.

另一种可能是退回到使用简单的 API 访问密钥.

Another possibility would be to fall back to using a Simple API Access key.

更新:

第一种方法似乎不适用于 Google.

First method seems to not work with Google.

Android 的推荐方法是使用 AccountManager 而不是烘焙你自己的要求.按照此示例 了解情况如何实现以及如何使用简单 API 访问密钥获取 AuthToken.您可以不使用 Tasks API,而是包含 OAuth2用于检索用户信息的 API 库.

The recommended way for Android is to use AccountManager instead of baking your own requests. Follow this example to see how this is implemented and how you get an AuthToken using a Simple API Access key. Instead of using the Tasks API you can then include the OAuth2 API library to retrieve the userinfo.

这篇关于Google API 控制台 - 缺少客户端密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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