Я создаю логин, используя экземпляр formRequest
в качестве параметра, после того как я проверил доступ пользователя, я добавляю к запросу параметры, которым нужен oauth-сервер.
однако я получаю ошибка сервера oauth:
{
"error": "unsupported_grant_type",
"error_description": "The authorization grant type is not supported by the authorization server.",
"hint": "Check that all required parameters have been provided",
"message": "The authorization grant type is not supported by the authorization server."
}
, но когда я изменяю экземпляр моего параметра на Request, я больше не получаю эту ошибку.
Шаги для воспроизведения:
class AuthController extends Controller
{
use ThrottlesLogins;
public function store(LoginRequest $loginRequest)
{
//$loginRequest->validated();
if ($this->hasTooManyLoginAttempts($loginRequest)) {
$this->fireLockoutEvent($loginRequest);
return $this->sendLockoutResponse($loginRequest);
}
if (Auth::attempt($this->credentials($loginRequest))){
$client = $this->getClient($loginRequest->name);
$params = [
'grant_type' => 'password',
'client_id' => $client->id,
'client_secret' => $client->secret,
'username' => $loginRequest->email,
'password' => $loginRequest->password,
'scopes' => 'fd',
];
$loginRequest->request->add($params);
$req = Request::create('oauth/token', 'POST');
$response = Route::dispatch($req)->getContent();
return $response;
}
$this->incrementLoginAttempts($loginRequest);
$this->sendFailedLoginResponse($loginRequest);
}
}