Google oauth2.0重定向URI缺少哈希(#)和路径
我正在使用Google API实现OAuth 2.0,但是Google的重定向URI缺少哈希(#)和路径。这导致我的解析失败。我正在为网络浏览器建造。
我向Google要求URI:https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A4002%2Fsso-callback&response_type=token&state=C2ubRxTMwv&client_id=...
redirect_uri
解码为http:// localhost:4002/sso-callback
Google的重定向URI:http:// localhost:4002/state = c2ubrxtmwv& access_token = ...
这同时缺少/sso-callback
路径和#
在使用response> response> response_type = token
不确定这是配置问题还是Google问题。
I am implementing OAuth 2.0 with Google API's, but the redirect Uri from Google is missing the hash (#) and path. Which causes my parsing to fail. I am building for Web Browsers.
My Request URI to Google:https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=http%3A%2F%2Flocalhost%3A4002%2Fsso-callback&response_type=token&state=C2ubRxTMwv&client_id=...
The redirect_uri
decodes to http://localhost:4002/sso-callback
Google's Redirect URI:http://localhost:4002/state=C2ubRxTMwv&access_token=...
Which is missing both the /sso-callback
path and the #
needed to distinguish the OAuth params when using response_type=token
Not sure if this is a config issue, or a Google issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当我通过将其粘贴到Chrome的地址栏中提交该URL时:
我收到一个注释的重定向
:Google Auth Server似乎仅使用Google Console中配置的第一个重定向URI。在您的情况下,它是
尝试将所需的重定向URI放置
在控制台中的第一个位置。
When I submit this URL by pasting it in the address bar in Chrome:
I receive a redirect to
A few notes: Google auth server seems to only use the first redirect URI configured in Google Console. In your case it is
Try placing your desired redirect URI
in the first position in the Console.
事实证明,有一个SSR重定向正在打破我不知道的URL。 Delta George的答案让我尝试了其他一些URL,这使该问题清楚了。
Turns out there was an SSR redirect that was breaking the urls that I did not know about. The answer by Delta George got me to try out a few other urls which made the issue clear.