Introducing the Dingo Api and JWT
Github-dingo
Githun-jwt
Dingo and JWT Github-wiki under the installation directory, respectively.
"Dingo/api": "1.0.* @dev"
"Tymon/jwt-auth": "0.5.*"
Write to the Laravel framework file under the Composer.json file in the "Require" collection as shown in the figure:
And then run it under the Laravel directory.
Composer Update
After installation, you need to add the following configuration information in the Config directory app.php file:
Dingo\api\provider\laravelserviceprovider::class
Tymon\jwtauth\providers\jwtauthserviceprovider::class
' Jwtauth ' = Tymon\jwtauth\facades\jwtauth::class
' Jwtfactory ' = Tymon\jwtauth\facades\jwtfactory::class
After filling in the configuration information, run the following command to generate the api.php and jwt.php configuration files in the Config directory
PHP artisan vendor:publish–provider= "Dingo\api\provider\laravelserviceprovider"
PHP artisan vendor:publish–provider= "Tymon\jwtauth\providers\jwtauthserviceprovider"
Finally execute the following command to generate key to record token's
PHP Artisan Jwt:generate
Specific configuration prior to use
Add in the. env file
Configuring validation in the api.php auth module
In the kernel file
Then the configuration is complete.