如何使用OAuth 2实现静默登录并获取谷歌的代码/令牌

4

我是一个新手,正在学习谷歌的Oath技术。

参考谷歌文档,当我生成登录URL时,例如:

https://accounts.google.com/o/oauth2/auth?
redirect_uri=http://www.mywebapp.com/oauth2callback&
response_type=code&
client_id=104608secret-secret-secret-secret.apps.googleusercontent.com&
scope=https://www.googleapis.com/auth/analytics.readonly+https://www.googleapis.com/auth/userinfo.email&
approval_prompt=force&
access_type=offline

这将重定向到一个接受页面,显示Google 电子邮件ID

当用户点击“接受”后,Google将重定向用户到您提供的redirect_url

当我使用Chrome和https://developers.google.com/oauthplayground/时,因为它会重定向到接受屏幕,所以一切都会正常工作。

但是,当我使用Postman时,它不会返回Google的“访问代码”

在url参数中,我错了什么?

我必须使用上述URL创建REST服务。

我已经搜索了以下问题:如何获取虚拟Google访问令牌测试oauth google api?如何验证Google认证API访问令牌?https://developers.google.com/identity/protocols/OAuth2https://www.themarketingtechnologist.co/google-oauth-2-enable-your-application-to-access-data-from-a-google-user/

但是没有一个解释了如何进行静默登录以获取无需接受屏幕的访问令牌。

1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接