oauth-2.0 - Google Oauth2.0 端点返回 404 错误
问题描述
我正在尝试使用 http 请求获取访问令牌。根据 Oauth 指南:
https ://developers.google.com/identity/protocols/oauth2/web-server#incrementalAuth
用于交换授权码以访问令牌的端点是,https://oauth2.googleapis.com/token
但它给出了一个页面找不到 HTTP 404 错误这是我的完整网址(我已经替换了代码、客户端 ID 和机密)
https://oauth2.googleapis.com/token?
code=xxxxx&
client_id=xxxxx&
client_secret=xxxxx&
redirect_uri=http://localhost&
grant_type=authorization_code
解决方案
看起来您正在将必填字段作为查询参数传递,但您需要将它们放在帖子正文中并向https://oauth2.googleapis.com/token发送 HTTPS POST 请求。您可以在您所指的文档中进一步找到此信息:https ://developers.google.com/identity/protocols/oauth2/web-server#httprest_7 。
推荐阅读
- angular - Servlet cookie 适用于 postman windows 应用程序,但不适用于 chrome 或 postman chrome 扩展
- javascript - 在 ES6 模块中导入同名函数的最佳方法
- flutter - 尝试嵌入平台视图,但 PrerollContext 不支持嵌入 youtube_player_flutter
- bootstrap-4 - 如何使用 django 上的引导程序使 jinja2 模板随屏幕大小变化?
- python - os.path.expanduser("~") + "/Downloads/" 不工作
- java - 特定按钮拒绝在 Android Studio 中工作
- powershell - 试图将字符串数组转换为日期
- identityserver4 - 在 identityserver4 和自定义 AuthorizationHandler User.Identity.isAuthenticated = false 上使用客户端凭据流
- android - SQLite 奇怪的行为
- javascript - 如何根据 div 的宽度调整 font-size 属性?