Course Hero Logo

03 - Laravel 8 - Passport (OAuth2).pptx - Restful API with...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 16 out of 16 pages.

Restful APIwith Laravel 8Laravel Passport
Objective1.Installation2.Password Grant Tokens3.Protecting Routes
1. InstallationInstall Passport via the Composer package managecomposer require laravel/passportTo migrate your database, type:php artisan migrateThen type command below to create the encryptionkeys needed to generate secure access tokens.(open “oauth_clients” table to see the keys)php artisan passport:install
Add theLaravel\Passport\HasApiTokenstrait to yourApp\Usermodel
Modify theAuthServiceProviderclass located inapp\Providers\AuthServiceProvider.php
Finally, in yourconfig/auth.phpconfiguration file, youshould set the driver option of theapiauthenticationguard topassport.
2. Password Grant Tokens2.1. Creating A Password Grant Client2.2. Requesting Tokens2.3. Customizing The Username Field
2.1. Creating A Password Grant ClientTo create a new
End of preview. Want to read all 16 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Winter
Professor
N/A
Tags
Security token, php artisan, Laravel Passport

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture