kasthuri's avatar

`POST https://graph.facebook.com/v3.3/oauth/access_token` resulted in a `400 Bad Request` response:

I am trying to get user access with a Facebook login and I get this error. I try every solution but did not work. I am working with localhost. valuable codes are here

service.php

'facebook' => [ 'client_id' => env('FACEBOOK_CLIENT_ID'), 'client_secret' => env('FACEBOOK_CLIENT_SECRET'), 'redirect' => ' http://localhost:8000/login/facebook/callback',

loginController

public function handleProviderCallback()
{

$user = Socialite::driver('facebook')->stateless()->user();

}

the controller is work without user();

0 likes
8 replies
siangboon's avatar
{
   "error": {
      "message": "Missing redirect_uri parameter.",
      "type": "OAuthException",
      "code": 191,
      "fbtrace_id": "AzSe_q6SF-tvZ9qPV0r39Ni"
   }
}

i think you may try use redirect_uri instead of redirect

1 like
kasthuri's avatar

but sir in the socialite there is no redirect_uri parameter. when I use redirect_uri there is an error Undefined index: redirect in E:\Encode project\Socialist\social\vendor\laravel\socialite\src\SocialiteManager.php:168

lamalamaMark's avatar

Have you been able to solve this? Encountering the same issue in a project at the moment.

1 like
Mavichow's avatar

Hey all, has anyone encounter this problem lately?

I had my socialite setup weeks & working fine with Laravel 8 & latest socialite package.

and suddenly i couldn't login with Facebook and the error stated

Client error: POST https://graph.facebook.com/v3.3/oauth/access_token resulted in a 400 Bad Request response: {"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191,"fbtrace_id":"AtCr44WTEST-ABCDe (truncated...)

I've check the redirect url with method below: Socialite::driver('facebook')->redirect()->getTargetUrl()

and it does return with the redirect_uri tho:

https://www.facebook.com/v3.3/dialog/oauth?client_id=1234567&redirect_uri=http%3A%2F%2Flocalhost%2Ftest%2Fapp%2Fpublic%2Fauth%2Fcallback_facebook&scope=email&response_type=code&state=12345

Atal19's avatar

Tried everything in the world. nothing seems to work. been working on this for a week and just want to break my new 16 inch MacBook pro.

Mavichow's avatar

Should be problem from FB end.... it's working right now, i can die in peace.

NgoanRoyal's avatar

your app type is not a business app and you can login using Socialite

KareemShellbaya88's avatar
try{

        $facebookuser = Socialite::driver('facebook')->user();

    }catch(\Exception$e){

        return redirect()->to('/login')->with('error','Authentication Failed !');
        }

  				 This Works With Me .
				Your Error IS Due To The User Cancelled Facebook Login

Please or to participate in this conversation.