- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在通过 Google 进行 Socialite 身份验证时遇到问题。我有两个独立的应用程序:Laravel 和 React Native。对于 native 应用程序,我使用 @react-native-community/google-signin 并在客户端上获取 token 后将其发送到 Laravel 应用程序,在那里我将此 token 传递给 Socialite 函数: Socialite::driver('google ')->userFromToken($token); .我收到此错误:
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"
}
最佳答案
根据我对类似问题的研究 - 看起来 Google 一键式的工作方式与 oAuth 的工作方式不同。
因此,您必须从 $token
中获取用户。手动,使用 google/apiclient
包裹。
谷歌文档中有一个例子(它在 android
部分,但这些特定的片段指的是后端部分,所以它仍然应该可以解决问题)composer require google/apiclient
// Get $id_token via HTTPS POST.
$client = new Google_Client(['client_id' => $CLIENT_ID]); // Specify the CLIENT_ID of the app that accesses the backend
$payload = $client->verifyIdToken($id_token);
if ($payload) {
$userid = $payload['sub'];
// If request specified a G Suite domain:
//$domain = $payload['hd'];
} else {
// Invalid ID token
}
您可以在此找到更多信息
Google Docs Page
关于php - 使用 Google ID token 和 Laravel Socialite 授权 native 应用程序用户提供 401,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61748355/
我已经在 laravel 5.6 上使用 socialite 3.2.0 设置了一个 google 登录。身份验证确实工作得很好。我想要一个自定义重定向,我尝试了我最好的方法,但它在注册后重定向到主页
我目前正在将 Socialite 添加到我的网站以允许用户从 Facebook 登录。 public function redirectToProviderFacebook() { retur
我正在尝试将社交名流整合到网站中,但遇到了一个问题,这应该是一件相当琐碎的事情 - 在社交提供商进行身份验证后更改用户的重定向位置。 我将使用 Socialite 来执行三项操作: 注册 - 向提供商
我最近将我的应用程序移至实时服务器中。 问题是 Laravel Socialite 停止工作,解释如下: 我点击谷歌登录并选择电子邮件后,回调时会发生这种情况: Abstract.php 第 200
我正在使用 Laravel 的 Socialite 向应用程序添加社交身份验证。我可以检索全名,但不能分别检索名字和姓氏。回调发生后,Socialite 正在处理它,成功检索到用户。如果我要转储我从
我有一个使用 socialite 的应用程序,我想为 Github 身份验证创建测试,所以我使用 Socialite Facade 模拟调用 Socialite driver 方法,但是当我运行测试时
基本上我想从 Linkedin 获取用户个人资料链接。我将 Laravel Socialite 与 Socialite Providers 一起使用从 Linkedin 获取信息。 当用户成功重定向回
您好,我正在使用 Laravel Socialite 通过我的远程 Laravel Paspport 应用程序进行 Oauth 身份验证。成功获得用户身份验证后,当我想让用户进入应用程序时,它会将我重
Laravel Socialite有一个“无状态”模式,它禁止将任何内容存储到 session 中。从阅读源代码来看,它并没有做任何不同的事情——它只是不存储或检索这些值。 作为其中的一部分,它 as
我正在使用 Laravel 5.4 和 Socialite,因此我的用户可以使用 Facebook 登录。 我的网站使用子域 newyork.example.com, paris.example.co
我正在开发一个 flutter 应用程序,我想实现社交登录(谷歌和 Facebook)。 我的 API 是用 Laravel 实现的,并使用 Laravel-socialite 对用户进行身份验证,有
这里还有一个新问题,但希望有人能阐明一些: 我正在 Laravel 5 中使用 Socialite,我希望能够在用户登录后将用户重定向到网站上的页面。问题是使用 return redirect('an
在 Socialite 文档中,它说以下行获取用户信息: $user = Socialite::driver('twitter')->user(); 这自然假设回调源自 Twitter。但是,在某些情
我已经在我的应用程序中集成了 Laravel 默认身份验证,现在我想将社交登录与其集成。 这是工作流程 1.从社交名流获取用户详细信息(social_id,name,email,profile_pic
我做了什么: 添加 "laravel/socialite": "~2.0" 到 composer.json 运行 Composer 更新 添加提供者 'Laravel\Socialite\Social
Socialite(通过Socialite::driver(self::PROVIDER)->user())获取的access_token是有时间限制的,Google是一个小时. 我可以通过将重定向调
Laravel 5、Socialite 和 google/apiclient 软件包。 源代码:https://github.com/svpernova09/meatings 我让社交名流在 Goog
我尝试使用包 Laravel\Socialite在我的系统中 Lumen (5.1) 我在 config\services.php 中添加了这个文件 : [ 'client_id'
我正在尝试使用 laravel socialite 无状态选项通过 laravel api 后端集成社交登录,因为我正在使用 vuejs 构建一个单页应用程序,并且一切都是通过 http api 调用
我已收到 token-id来自谷歌生成的客户端安卓应用程序。 我如何向用户授权社交名流? 我现在正在使用 google_api 客户端,但它没有 Socialte 的便利。 最佳答案 如果您可以获得服
我是一名优秀的程序员,十分优秀!