This链接介绍如何手动进行身份验证。我想使用Google API来验证我的设备,因为它的输入功能有限。这是可能的吗?如何实现?如何使用gapi获取激活码,并展示给用户?
发布于 2017-01-30 17:37:10
您可以查看此文档: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和客户端密码后,向位于
https://accounts.google.com/o/oauth2/device/code的OAuth 2.0设备端点发送一个HTTPPOST,其中包含您的client_id和作用域列表。与其他OAuth 2.0流不同,设备流中不需要response_type和redirect_uri。以下是一个请求用户代码的示例:
POST /o/oauth2/device/code HTTP/1.1主机:表单内容类型:应用程序/x-www- accounts.google.com -form编码的client_id=812741506391-h38jh0j4fv0ce1krdkiq0hfvt6n5amrf.apps.googleusercontent.com& scope=email%20profile
您可以通读documentation以了解更多信息。
https://stackoverflow.com/questions/41920222
复制相似问题