php - Laravel Socialite 使用 Google 登录 - userFromToken
问题描述
我正在尝试使用 google 实现 Laravel 社交登录,但我遇到了给定的错误。
message: "Client error: `GET https://www.googleapis.com/oauth2/v3/userinfo?prettyPrint=false` resulted in a `401 Unauthorized` response:{ "error": "invalid_request", "error_description": "Invalid Credentials"}"
这是我的 Laravel 代码。
public function Sociallogin($provider,Request $request)
{
$token = $request->input('token');
$user = Socialite::driver($provider)->userFromToken($token);
die($user);
}
请注意,此代码在使用 Facebook 登录时有效。请帮我。
谢谢!
解决方案
是的,最后我找到了解决方案,发生的错误是我提供了错误的谷歌开发者帐户凭据。如果有人发生同样的错误,请验证凭据。
推荐阅读
- c# - Unity Fix NavMeshAgent 自动旋转 90 度
- python - 计算 numpy 数组之间的 MSE
- flutter - 如何删除文本字段的标签?
- vue.js - 离开页面时,我得到:未处理的 GraphQL 订阅错误错误:GraphQL 错误:未提供所需类型 xxx 的变量 xx
- android - 谷歌通过条纹支付
- python - 如何使用 Python 和 Pandas 查找具有单个字符的句子
- angular - 如果外部 observable 返回错误,则强制调用 switchMap 的内部 observable
- amazon-web-services - 使用 Ansible 的动态清单 (ec2.py) 的 Rundeck 作业
- python - 可靠地将数据帧从 EST(夏令时)转换为日本标准时间(无夏令时)
- android - 应用操作未使用应用操作测试工具运行