Giter Site home page Giter Site logo

lumen-auth-jwt's Introduction

Membuat Json Web Token (JWT) di Lumen 5.7

#tools & depedency
firebasephp-jwt version 5.0 Postman
#install fresh Lumen
lumen new lumen-auth-jwt
#buat file .env & tambahkan APP_KEY + JWT_SECRET
cp .env.example .env Tambahkan nilai pada APP_KEY & JWT_SECRET.
#buat table users menggunakan migration
php artisan make:migration create_users_table
#buat data dummy dengan faker
1. Edit 'database/factories/ModelFactory.php' 2. Buat 'UsersTableSeeder' dengan 'php artisan make:seeder UsersTableSeeder' 3. Tambahkan code di 'UsersTableSeeder' untuk membuat data seed menggunakan factory 4. Daftarkan 'UsersTableSeeder' di 'database/seeds/DatabaseSeeder.php' 5. Eksekusi dengan perintah 'php artisan migrate' & 'php artisan db:seed'
#Aktifkan Facades & Eloquent di bootstrap/app.php
#Menggunakan library jwt firebase/php-jwt dan install via composer
composer require firebase/php-jwt
#membuat route untuk login 'auth/login'
$router->post('/auth/login', ['uses'=>'AuthController@authenticate']);
#membuat controller 'AuthController' dan method 'authenticate'
#test get token dengan akses localhost:8000/auth/login
#buat middleware untuk proteksi request
#aktifkan middleware di 'bootstrap/app.php'
#buat route untuk get user yang diproteksi middleware
#test get user dengan token di localhost:8000/users

lumen-auth-jwt's People

Contributors

kutub-utara avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.