thephpleague / oauth2-server

A spec compliant, secure by default PHP OAuth 2.0 Server
https://oauth2.thephpleague.com
MIT License
6.52k stars 1.12k forks source link

resulted in a `400 Bad Request` response: {"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid paramet (truncated...) #1191

Closed MehdiJafari395 closed 3 years ago

MehdiJafari395 commented 3 years ago

hi i'm using authorization code in laravel and i have this error :

Client error: POST http://localhost:8000/oauth/token resulted in a 400 Bad Request response: {"error":"invalid_request","error_description":"The request is missing a required parameter, includes an invalid paramet (truncated...)

and this is my code :

Route::get('/info-bank/callback', function(Request $request){

if($request->has('error')){
    return response(['massage'=>'user dont let']);
};

$http = new GuzzleHttp\Client();

$aaa = $http->post('http://localhost:8000/oauth/token', [
    'form_params'=>[
        'grant_type'=>'authorization_code',
        'client_id'=>9,
        'client_secret'=>'0NWFQANxFKHOkwQcUA2cXddqn5t4F8aG4HIOlTUa',
        'redirect_uri'=>'http://localhost:8002/info-bank/callback',
        'code'=>$request->code,
    ]
]);
dd($http);

});

Sephster commented 3 years ago

The exception thrown normally contains a hint that will tell you what parameter is missing. You can call getHint() on the Exception to find out what the issue is. Hope this helps!