Last active
January 7, 2020 07:54
-
-
Save moradi-morteza/d1de05a7f1254cc9f81e52e6ef1555f5 to your computer and use it in GitHub Desktop.
[passport]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer require laravel/passport | |
php artisan migrate | |
php artisan passport:install | |
//2- in Class AuthServiceProvider: | |
public function boot() | |
{ | |
$this->registerPolicies(); | |
Passport::routes(); // if you donot want to user route comment this line | |
// now if you run php artisan route:list you can see the routes | |
} | |
//3- in file config\auth | |
'api' => [ | |
'driver' => 'passport', | |
'provider' => 'users', | |
'hash' => false, | |
], | |
//4- ************ php artisan config:clear , php artisan config:cache***************** | |
//5- change UserModel to : | |
class User extends Authenticatable {use Notifiable,HasApiTokens;} | |
//you should set your grand type to password and then you can post your data to root/aouth/token | |
{ | |
"username":"mabnagroupeaf@gmail.com", | |
"password":"112859", | |
"grant_type":"password", | |
"client_id":2, | |
"client_secret":"LTJGFEOJiGWZgwfIl1SbLvBwft3neAs3NGgDL1Lq" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment