Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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