Articles

July 8, 2019

Laravel Passport - Column Validation Overrides

When using Laravel Passport, you can override the columns that you use to validate username and password for password grant clients (default is email and password) by adding these methods on your User model. // Within your User model, add the following methods.. use Illuminate\Support\Facades\Hash; ... public function findForPassport($username) { return $this->where('other_username_column', $username)->first(); } public function validateForPassportPasswordGrant($password) { return Hash::check($password, $this->some_other_password_attribute); } Source: `Laravel\Passport\Bridge\UserRepository@getUserEntityByUserCredentials`

Marvin Quezon · Copyright © 2025 · Privacy · Sitemap