When you run command
php artisan passport:client --password
You received information like:
New client created successfully.
Client ID ........... <client_id>
Client Secret ... <secret>
And Laravel must save client secret to database with hash format.
And you can grant password with params like that:
url : <app_url>/oauth/token
params:
'grant_type' => 'password',
'client_id' => <client_id>,
'client_secret' => <,
'username' => <user_email>,
'password' => <user_password>,
'scope' => '*',
Example:
public function getTokenAndRefreshToken($email, $password)
{
$data = [
'grant_type' => 'password',
'client_id' => $clientId,
'client_secret' => $secretId,
'username' => $email,
'password' => $password,
'scope' => '*',
];
$response = Http::asForm()->post(config('app.url') . '/oauth/token', $data);
return json_decode((string)$response->getBody(), true);
}