Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akase244/8bb9349140f67c9d0df703d8256a8d06 to your computer and use it in GitHub Desktop.
Save akase244/8bb9349140f67c9d0df703d8256a8d06 to your computer and use it in GitHub Desktop.
app/Providers/FacebookProvider.php
<?php
namespace App\Providers;
use Laravel\Socialite\Two\FacebookProvider as OriginalFacebookProvider;
class FacebookProvider extends OriginalFacebookProvider
{
protected function getUserByToken($token)
{
$meUrl = $this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&fields='.implode(',', $this->fields).((\App::getLocale() === 'ja') ? '&locale=ja_JP' : '');
if (! empty($this->clientSecret)) {
$appSecretProof = hash_hmac('sha256', $token, $this->clientSecret);
$meUrl .= '&appsecret_proof='.$appSecretProof;
}
$response = $this->getHttpClient()->get($meUrl, [
'headers' => [
'Accept' => 'application/json',
],
]);
return json_decode($response->getBody(), true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment