laravel 社交名流从 google 授权码获得 google 访问令牌

laravel socialite get google access token from google Authorization Code

我有一个 Android 应用程序使用 google 身份验证来注册用户
我正在使用 laravel socillite 进行身份验证

我无法使用它,因为 android 应用向我发送了授权码而不是访问令牌,我不知道如何从 Authorization Code 中获取访问令牌
根据我的理解,我应该执行以下操作:

我确实通过使用 getAccessTokenResponse 函数解决了这个问题,如下所示:

$access_token = Socialite::driver($provider)->getAccessTokenResponse($token);
$user = Socialite::driver($provider)->userFromToken($access_token['access_token']);