Search code examples
laravellaravel-socialite

Bad Request when using Socialite on Facebook


I am using Socialite Package (https://laravel.com/docs/6.x/socialite) in my project.I have done following:

  • Register Application on Facebook
  • Get Client Secret and ID
  • Installed Socialite Package using composer
  • configure .env files
  • configure callback url

But when after successful callback, my app shows following errors on this command

Socialite::drive("facebook")->user()

error: Client error:
POST https://graph.facebook.com/v3.3/oauth/access_tokenresulted in a400 Bad Request

Response:

{
  "error":{
    "message": "URL \u0644\u0648\u0688 \u0646\u06c1\u06cc\u06ba 
  \u06a9\u06cc\u0627 \u062c\u0627 \u0633\u06a9\u062a\ (truncated...)
A:\xampp\htdocs\PLAGX_FRONTEND\px-web\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php

Solution

  • The issue is with the SSL of your callback url, the response seems to be not properly decoded by the receiver party. Turning SSL on your localhost or deployment server could help.