Laravel Configuring Dingoapi and JWT

Source: Internet
Author: User

Introducing the Dingo API and JWT

1, add in the Require of Composer.json

" require " : {    "dingo/api""1.0.* @dev",
    "Tymon/jwt-auth" "0.5.*   "
}

2. Execute composer update to introduce the newly added package

Configuring the Dingo API

1, configuration Provider

Dingo\api\provider\laravelserviceprovider::class,

2. Build configuration file for easy configuration:

PHP artisan vendor:publish--provider="dingo\api\provider\laravelserviceprovider"

The api.php configuration file is generated in the Config folder after execution, and the Dingo API configuration is complete.

Configure JWT

1, configuration Provider

Tymon\jwtauth\providers\jwtauthserviceprovider::class

2, configuration aliases

        ' Jwtauth ' = = Tymon\jwtauth\facades\jwtauth::class,        'jwtfactory' = = Tymon\jwtauth\facades\jwtfactory::class

3. Generate Configuration file

PHP artisan vendor:publish--provider="tymon\jwtauth\providers\jwtauthserviceprovider" 

The jwt.php configuration file is generated in the Config folder after execution

4. Generate Secret Key

PHP Artisan Jwt:generate

Configuration is complete.

Laravel Configuring Dingoapi and JWT

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.