Skip to content

Instantly share code, notes, and snippets.

@moradi-morteza
Last active January 7, 2020 07:54
Show Gist options
  • Save moradi-morteza/d1de05a7f1254cc9f81e52e6ef1555f5 to your computer and use it in GitHub Desktop.
Save moradi-morteza/d1de05a7f1254cc9f81e52e6ef1555f5 to your computer and use it in GitHub Desktop.
[passport]
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