1 / 8

https://www.letsnurture.com/blog/create-api-rest-with-laravel-passport-authentication.html

Create API Rest with Laravel Passport ..............<br><br>Laravel Passport is an OAuth2 server and API authentication package that is simple and enjoyable to use.<br><br>If your application absolutely needs to support OAuth2, then you should use Laravel Passport.<br><br>Laravel Passport provides a full 0Auth2 server implementation. With it, you can easily generate a personal access token to uniquely identify a currently authenticated user.

robinmark
Download Presentation

https://www.letsnurture.com/blog/create-api-rest-with-laravel-passport-authentication.html

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GET A PROPOSAL Create API Rest with Laravel Passport Authentication In Lets Nurture  290 VIEWS 28 Dec. 20 Laravel Passport is an OAuth2 server and API authentication package that is simple and enjoyable to use. If your application absolutely needs to support OAuth2, then you should use Laravel Passport. Laravel Passport provides a full 0Auth2 server implementation. With it, you can easily generate a personal access token to uniquely identify a currently authenticated user. 1. Installation For installing this package Run this command from the Terminal: composer require laravel/passport Once the installation is complete, passport migrations will create the tables your application needs to store clients and access tokens.Run the following command to migrate your database: php artisan migrate

  2. We use cookies to give you tailored experiences on our website.We use cookies to give you tailored experiences on our website. Okay 2. Generate keys This command will create the encryption keys needed to generate secure access tokens. php artisan passport:install After the installation process, add the Laravel\Passport\HasApiTokens trait to your App\User model as shown here: Now, to register the routes necessary to issue and revoke access tokens, call the Passport::routes method within the boot method of your AuthServiceProvider. To do this, open the app/Providers/AuthServiceProvider 몭le and update its content as shown below:

  3. Finally, open con몭g\auth.php and set the driver of API to passport in the guards array shown below. 3. Create API Routes Laravel provides routes/api.php 몭le for writing web services routes. So, add a new route on that 몭le.

  4. 4. Create API Controller Create function in your controller 몭le Login function  Logout function 

  5. 5. Test API in Postman Add Request data in postman for Login The API will return a token, which we will use in further requests as our means to authentication.

  6. For logout using this token In Postman, the “Authorization” tab has a drop-down where the type can be set to “Bearer Token,” after which the token can go into the token 몭eld. And you will successfully log out. O몭cial Documentation For more information and details you can read the o몭cial document from Laravel website. « What is Deep Learning? How to Setup yajra data table in Laravel » Sign up our Newsletter!

  7. SUBMIT  Author Posted by Lets Nurture  C O N TACT U S Have an !dea or need help with your current business?         60 Min Free Consulting Call. Detailed Feature List. Strict NDA Policy Multiple business models supported Free Mockup & Wireframe Free MNP Access to Exclusive Digital Assets $500 Digital Gifts  Name* Email* Mobile No.* (201) 555-0123 Select Project Budget* Not Sure

  8. Tell us about your requirement* What's 19 + 4 = SUBMIT  Let’s Nurture Infotech Pvt Ltd is operational in New York, Seattle, Chicago & Washington in US, Ottawa & Charlottetown, Canada ( Nurturing Technologies Pvt ltd ), London & Glasgow in UK, Singapore, Melbourne in Australia, Ahmedabad in India. © 2021 All rights reserved

More Related