我遇到了 Unable to resolve PSR request error with GuzzleHttp request

I got Unable to resolve PSR request error with GuzzleHttp request

在我的 Laravel 7.6 应用程序中实施(pt hosts at http://local-votes.com of my local OS) api for external api 我想向我的其他人发出测试请求 Laravel 6.17.1 应用程序和在这里阅读:https://laravel.com/docs/7.x/passport 将授权代码转换为访问令牌

我尝试使用这个例子:

        $http = new \GuzzleHttp\Client;

        $client_id= 3;  // client ID I made in my host app
        $client_secret= 'XXX'; // client secret I made in my host app

        $host= 'http://local-votes.com';
        $response = $http->post($host.'/oauth/token', [
            'form_params' => [
                'grant_type' => 'authorization_code',
                'client_id' => $client_id,
                'client_secret' => $client_secret,
                'redirect_uri' => $host.'/votes',
                'code' => 'code',
//                'code' => $request->code,
            ],
        ]);

但是我得到了错误:

Illuminate\Contracts\Container\BindingResolutionException: Unable to resolve PSR request. Please i (truncated...)
 {"userId":5,"exception":"[object] (GuzzleHttp\Exception\ServerException(code: 500): Server error: `POST http://local-votes.com/oauth/token` resulted in a `500 Internal Server Error` response:

我也不确定我为字段 'client_secret' 和 'code' 提供了哪些值? 这可能是问题所在吗?

如何解决这个错误?

谢谢!

安装包nyholm/psr7 在提供商应用程序上解决了问题!