阅读(4987) (11)

Laravel 8 获取用户实例

2021-07-09 14:25:41 更新

有了用户实例之后,你就可以获取更多用户详情:

$user = Socialite::driver('github')->user();

// OAuth2 Providers
$token = $user->token;
$refreshToken = $user->refreshToken; // 有时会被提供
$expiresIn = $user->expiresIn;

// OAuth1 Providers
$token = $user->token;
$tokenSecret = $user->tokenSecret;

// 所有 Providers
$user->getId();
$user->getNickname();
$user->getName();
$user->getEmail();
$user->getAvatar();