简体   繁体   English

Laravel Socialite 访问令牌和令牌

[英]Laravel Socialite Access Token And Token

I need help about laravel socialite.我需要有关 Laravel 社交名媛的帮助。
I use google service to pre-autheticate my app.我使用谷歌服务来预认证我的应用程序。

Socialite::driver('google')->user()->token

Is the above token equal to the Google access token?上面的令牌是否等于谷歌访问令牌?

Yes it is the access token.是的,它是访问令牌。 socialite uses authorization code to retrieve accesstoken.社交名流使用授权码来检索访问令牌。

If you want to verify , do like this如果要验证,请执行以下操作

$token = Socialite::driver('google')->user()->token
$user = Socialite::driver('google')->userFromToken($token);

From the Laravel Socialite docs:来自 Laravel Socialite 文档:

Socialite::driver('google')->user() returns your user object/model. Socialite::driver('google')->user()返回您的用户对象/模型。 So, Socialite::driver('google')->user()->token returns the token on your user model.因此, Socialite::driver('google')->user()->token返回用户模型上的令牌。

Unless you stored the google access token on your user model, this is not the Google access token除非您在用户模型上存储了 google 访问令牌,否则这不是 Google 访问令牌

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel Socialite 令牌刷新 - Laravel Socialite token refreshing 在 Laravel 5.4 上使用社交名流检索 Facebook 用户访问令牌 - Retrieving facebook user access token with socialite on laravel 5.4 Laravel 在每个请求中验证社交名流令牌 - Laravel validating socialite token in every request 使用Laravel Socialite获取Google刷新令牌 - Getting Google Refresh Token with Laravel Socialite Laravel Socialite错误:“必须使用活动访问令牌来查询有关当前用户的信息。” - Laravel Socialite error: “An active access token must be used to query information about the current user.” Laravel使用Socialite(Google,Facebook等)登录并创建我自己的应用程序的访问令牌 - Laravel login with Socialite (google, facebook, etc) and create an access token of my own app Laravel 社交名流通过谷歌登录刷新令牌是 null - Laravel socialite through google login refresh token is null Laravel Socialite Facebook错误:“POST https://graph.facebook.com/oauth/access_token导致'400 Bad Request`” - Laravel Socialite Facebook error: “POST https://graph.facebook.com/oauth/access_token resulted in a `400 Bad Request` ” Instagram PHP Laravel访问令牌 - Instagram php laravel access token 如何在 Laravel 中从 Socialite 和 Google API 客户端获取 id_token - How to get the id_token from Socialite and Google API Client in laravel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM