Description
Passport Version
13.0
Laravel Version
12.14.1
PHP Version
8.3
Database Driver & Version
No response
Description
`<?php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, Notifiable;
/**
* Find the user instance for the given username.
*/
public function findForPassport(string $username): User
{
return $this->where('username', $username)->first();
}
}`
in the docs i have found this so i rename the field to phone but when i dd here and hit the api it does not work
and also when i add this method my ide says method not used , i checked but did not find the base method whatsoever
and one more thing some docs says
class User extends Authenticatable implements OAuthenticatable
and some without the OAuthenticatable why is that
Steps To Reproduce
install laravel latest
run the api install command with passport
create password client use it like
`$client = Client::query()->where('provider', 'users')->first();
$response = Http::asForm()->post(url('/oauth/token'), [
'grant_type' => 'password',
'client_id' => $client->id,
'client_secret' => $client->secret,
'username' => $request->input('phone'), // or email
'password' => $request->input('password'),
'scope' => '*',
]);`
it will give you unauthorize