How to use Laravel Passport with Password Grant Tokens?
Are you fond of using Laravel? While Laravel is known to make it easier to perform authentication through the use of traditional login forms, still the users are unsure of using the APIs. APIs on Laravel are typically known to make use of tokens for authenticating the users. The APIs do not maintain any specific session state between multiple requests. Laravel aims at making API authentication quite a breeze with the help of its Laravel Passport feature. The Laravel Passport is known to provide a full-end OAuth2 server implementation for the respective Laravel application in some minutes. Laravel Passport has been designed upon the League OAuth2 Server –maintained by Simon Hamp and Andy Millington.
Making Use of Laravel Passport When you wish to deploy a Passport to the respective production servers for the first time, you are required to run the passport:keys command. The specific command is responsible for generating the encryption keys that are needed by Passport for generating access tokens. The keys that are generated are usually not kept in the source control.
“php artisan passport:keys” If there is a requirement, you might even consider defining the specific path wherein the Passport keys should be loaded from. You can make use of the command “Passport::loadkeysFrom” for achieving the same.