Skip to content

Laravel basic API example of authentication using JWT (1.0.0.rc-3)

Notifications You must be signed in to change notification settings

mxlopez25/LaravelAuthenticationDemo

Repository files navigation

Laravel Authentication Demo (JWT)

  1. Install dependencies
    composer install

  2. Use .env.example file as template and save as .env file. Here configure database connection and app URL.

  3. Install Homestead
    Mac/Linux:
    php vendor/bin/homestead make

    Windows:
    //vendor//bin//homestead make

  4. Create host address for project, edit hosts file (will need admin rights):
    Mac/Linux:
    nano /etc/hosts

    Windows:
    C:\Windows\System32\drivers\etc\hosts

  5. Generate application key
    php artisan key:generate

  6. Generate JWTAuth secret key for token signing:
    php artisan jwt:secret

  7. Create and run Homestead virtual machine
    vagrant up

  8. After virtual machine is running, run migrations
    php artisan migrate

  9. Now the Demo is ready for use, try:
    To register a user:

     URL:
         <Host>/api/register  
     Data:  
     {  
         "name" : "User One",  
         "email: : [email protected]",  
         "password" : "123456",  
         "password_confirmed" : "123456"  
     }  
    

    To login user:

     URL:
         <Host>/api/login  
     Data:        
     {  
         "email: : [email protected]",
         "password" : "123456"
     }
    

About

Laravel basic API example of authentication using JWT (1.0.0.rc-3)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages