【发布时间】:2017-06-14 16:25:40
【问题描述】:
This 链接描述了如何手动进行身份验证。我想改用 Google API 来验证我的输入功能有限的设备。有可能吗?怎么做?如何使用gapi获取激活码,会显示给用户?
【问题讨论】:
标签: javascript google-api youtube-api google-oauth
This 链接描述了如何手动进行身份验证。我想改用 Google API 来验证我的输入功能有限的设备。有可能吗?怎么做?如何使用gapi获取激活码,会显示给用户?
【问题讨论】:
标签: javascript google-api youtube-api google-oauth
您可以查看此文档:Using OAuth 2.0 for TV and Limited Input Device Applications。但是,此处描述的 TV 和受限输入设备 OAuth 端点仅支持limited set of scopes。
与其他 OAuth 2.0 场景相同,您首先需要在Google API Console 中建立一个项目以获取客户端 ID 和客户端密钥。
获得客户端 ID 和客户端密码后,您可以将 HTTP
POST发送到位于https://accounts.google.com/o/oauth2/device/code的 OAuth 2.0 设备端点,其中包含您的client_id和范围列表。与其他 OAuth 2.0 流程不同,设备流程中不需要response_type和redirect_uri。以下是用户代码的示例请求:POST /o/oauth2/device/code HTTP/1.1 Host: accounts.google.com Content-Type: application/x-www-form-urlencoded client_id=812741506391-h38jh0j4fv0ce1krdkiq0hfvt6n5amrf.apps.googleusercontent.com& scope=email%20profile
您可以阅读documentation了解更多信息。
【讨论】: