oauth - YouTube 授权码交换失败并出现 redirect_uri_mismatch
问题描述
我正在尝试将授权代码交换为访问代码,但我收到一条错误消息“ redirect_uri_mismatch ”。
我等了大约 8 个小时以防它需要更新,但到目前为止还没有运气。
初始前端重定向/请求:
GET => https://accounts.google.com/o/oauth2/v2/auth
?scope=https://www.googleapis.com/auth/youtube.readonly
&include_granted_scopes=true
&state=state_parameter_passthrough_value
&redirect_uri=http://localhost:4200/profile?platform=youtube
&access_type=offline
&response_type=code
&client_id=[HIDDEN]
解析代码后,我将代码交换为访问代码:
POST => https://oauth2.googleapis.com/token
?client_id=[HIDDEN]
&client_secret=[HIDDEN]
&code=[HIDDEN]
&grant_type=authorization_code
&redirect_uri=http://localhost:2222/youtube/oauth
回复:
data: {
error: 'redirect_uri_mismatch',
error_description: 'Bad Request'
}
解决方案
显然,redirect_uri 必须与初始请求的 uri 匹配。问题已解决,请随时为可见性投票 - 谢谢。
推荐阅读
- javascript - js中的禁用和启用按钮
- typescript - TypeScript - 如何键入一个可以接受任意数量的字符串或数字参数的函数?
- mysql - 我如何根据另一列值 Mysql 获得平均值
- r - R根据条件计算值的总和
- php - 将 ajax 数据填充到 laravel 视图中
- android - python for android 在开始时崩溃:缺少模块“google_speech”和“gtts”
- python - 检查特定字符串是否存在于文本中的第一个或第二个位置
- php - 获取嵌套元素 PHP HTML Simple Dom
- javascript - 将浏览器窗口始终放在最前面以获取有效的用例
- javascript - 在 PHP 代码中使用 Jquery 输出值来显示图像