Skip to content

Commit

Permalink
Fix Twitch TypeError when refreshing tokens (SocialiteProviders#1186)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbeen authored Apr 1, 2024
1 parent d017e24 commit 2f46bdf
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Twitch/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use GuzzleHttp\RequestOptions;
use Illuminate\Support\Arr;
use Laravel\Socialite\Two\Token;
use SocialiteProviders\Manager\OAuth2\AbstractProvider;
use SocialiteProviders\Manager\OAuth2\User;

Expand Down Expand Up @@ -74,4 +75,19 @@ protected function mapUserToObject(array $user)
'avatar' => $user['profile_image_url'],
]);
}

/**
* {@inheritdoc}
*/
public function refreshToken($refreshToken)
{
$response = $this->getRefreshTokenResponse($refreshToken);

return new Token(
Arr::get($response, 'access_token'),
Arr::get($response, 'refresh_token'),
Arr::get($response, 'expires_in'),
Arr::get($response, 'scope', [])
);
}
}

0 comments on commit 2f46bdf

Please sign in to comment.