执行代理后出现
{message: “Call to a member function post() on null”,…}
exception:"Symfony\Component\Debug\Exception\FatalThrowableError"
file:"C:\laragon\www\api\app\Http\Proxy\TokenProxy.php"
line:34
message:"Call to a member function post() on null"
代码如下:
public function proxy($grantType,array $data=[])
{ data=arraymerge(data,[
‘client_id’ =>env(‘PASSPORT_CLIENT_ID’),
‘client_secret’ =>env(‘PASSPORT_CLIENT_SECRET’),
‘grant_type’ =>$grantType,
]); response=this->http->post(’/oauth/token’,[ // 这是提示的第 34行代码
’form_params’ => $data
]);
求教:
Client error: POST http://www.lec.cn/oauth/token resulted in a 400 Bad Request response:↵{“error”:“invalid_request”,“message”:"The request is missing a required parameter, includes an invalid parameter value
exception:"GuzzleHttp\Exception\ClientException"
file:"/Users/hahn/Practice/vue-spa/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php"
line:113
message:"Client error: `POST http://localhost:8000/oauth/token` resulted in a `400 Bad Request` response:{"error":"unsupported_grant_type","message":"The authorization grant type isnot supported by the authorization server." (truncated...)"
{message: “The given data was invalid.”, errors: {email: [“The email field is required.”]}
errors:{email: [“The email field is required.”]}message:"The given data was invalid."
POST http://www.eidetika-admin.com/api/login 422 (Unprocessable Entity)
public function login()
{
$this->validateLogin(request());
return $this->proxy->proxy(‘password’,[
‘username’=>request(‘username’),
‘password’=>request(‘password’),
‘scope’=>’’,
]);
}
username我并没有像老师那样取的是email,因为我vue用的也是username,请问是什么原因呢,我一直跟着视频走
这样请求在服务器上有个问题,会报401 的错误,Client error: POST http://***/oauth/token resulted in a 401 Unauthorized response:\n
{“error”:“invalid_credentials”,“message”:“The user credentials were incorrect.”}\n