Я использую Guzzle в своем приложении Laravel, чтобы сделать запрос к / oauth / token / в качестве запроса на вход и посмотреть, чтобы получить отказ в соединении
Мой код в моем настраиваемом контроллере:
public function login(Request $request)
{
$http = new \GuzzleHttp\Client();
try {
$response = $http->post("https://mixapp.test/oauth/token/", [
'form_params' => [
'grant_type' => 'password',
'client_id' => config('services.passport.client_id'),
'client_secret' => config('services.passport.client_secret'),
'username' => $request->username,
'password' => $request->password,
]
]);
return $response->getBody();
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
if ($e->getCode() === 400) {
return response()->json('Invalid Request. Please enter a username or a password.', $e->getCode());
} else if ($e->getCode() === 401) {
return response()->json('Your credentials are incorrect. Please try again', $e->getCode());
}
return response()->json('Something went wrong on the server.', $e->getCode());
}
}
И ошибка вроде бы такая:
local.ERROR: ошибка cURL 7: не удалось подключиться к порту mixapp.test 443: в соединении отказано (см. http://curl.haxx.se/libcurl/c/libcurl-errors.html) {" exception ":" [объект] (GuzzleHttp \ Exception \ ConnectException (code: 0): cURL ошибка 7: не удалось подключиться к порту mixapp.test 443: в соединении отказано
Оба находятся на https, и я использую камердинера laravel.