mardi 3 octobre 2017

Laravel 5.5 socialite not working

I recently tried to integrate laravel socialite with laravel 5.5 but i was getting an error :

GuzzleHttp \ Exception \ ClientException (400)
Client error: `GET http://ift.tt/2hKfxXg?
access_token=$my_token&appsecret_proof=my_proofsecret` resulted in a `400 Bad 
Request` response: {"error":{"message":"Error validating access token: Session  
has expired on Tuesday, 03-Oct-17 05:00:00 PDT. The current (truncated...)

Now i have debugged it to some extent and basically this is the line creating the error in FacebookProvider.php line number 89:

    protected function getUserByToken($token)
{
    $meUrl = $this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&fields='.implode(',', $this->fields);

    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);
}

this is the line :

  $appSecretProof = hash_hmac('sha256', $token, $this->clientSecret);

If i comment it out this whole if else block it seems to work fine... cant figure out whats wrong.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire