python - 尝试调用 google-api oauth2 时请求缺少所需的身份验证凭据
问题描述
我像这样在邮递员中通过有效负载发送我的 access_token,以在我的后端获取电子邮件、名称等信息。:
{
"access_token": "my-google-acces-token"
}
在后端,我尝试将此 access_token 发送到谷歌请求,如下所示:
response = requests.get('https://www.googleapis.com/oauth2/v2/userinfo',
headers={'Authorization': f'Bearer {access_token_data}'})
我得到了这个回应:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
我做错了什么?我的 google-access-token 是正确的
解决方案
推荐阅读
- c# - unity3D two box colliders(2D)常见边框问题
- python - 反转字典中元素的顺序
- mysql - 在查询结果中将列转置为行并将行转置为列
- android - Android 8 中的 FileObserver 不会触发 CREATE 事件
- javascript - 为javascript中的文本分配不同颜色的按钮
- javascript - 单击时多次更改 Div 背景颜色(循环)
- python - 如何识别python数据框中第一次出现的条件并对其进行计算?
- ionic-framework - 离子离子选项样式和类不起作用
- c++ - C ++为什么iostream如此庞大
- power-automate - 如何在电源自动化中捕获先前操作的输出