Laravel 5 Development API (Dingo API + JWT)

Source: Internet
Author: User
Tags auth php file php and

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.