Error: Unauthorize Grant type
<code>use LaravelPassportClient as OClient;
$oClient = OClient::where('password_client', 1)->first();
$client_id = $oClient->id;
$client_secret = $oClient->secret;
$request->request->add([
'username' => $email,
'password' => $password,
'grant_type' => 'password',
'client_id' => $client_id,
'client_secret' => $client_secret,
'scope' => ''
]);
$tokenRequest = Request::create(
env('APP_URL').'/oauth/token',
'post'
);
$response = Route::dispatch($tokenRequest);
</code>
<code>use LaravelPassportClient as OClient;
$oClient = OClient::where('password_client', 1)->first();
$client_id = $oClient->id;
$client_secret = $oClient->secret;
$request->request->add([
'username' => $email,
'password' => $password,
'grant_type' => 'password',
'client_id' => $client_id,
'client_secret' => $client_secret,
'scope' => ''
]);
$tokenRequest = Request::create(
env('APP_URL').'/oauth/token',
'post'
);
$response = Route::dispatch($tokenRequest);
</code>
use LaravelPassportClient as OClient;
$oClient = OClient::where('password_client', 1)->first();
$client_id = $oClient->id;
$client_secret = $oClient->secret;
$request->request->add([
'username' => $email,
'password' => $password,
'grant_type' => 'password',
'client_id' => $client_id,
'client_secret' => $client_secret,
'scope' => ''
]);
$tokenRequest = Request::create(
env('APP_URL').'/oauth/token',
'post'
);
$response = Route::dispatch($tokenRequest);
I have run command php artisan passport:client –password`
but still not working
New contributor
nayan parmar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.