Skip to content

restuhanputra/laravel-jwt-auth

Repository files navigation

Laravel_JWT_AUTH

Table of Contents

About

Simple Laravel JWT AUTH. build with Laravel 8, PHP 8, and MariaDB.

Routes API

Route prefix is auth, for detail check at routes/api.php

Method Endpoint
POST /api/auth/register
POST /api/auth/login
GET /api/auth/user-profile
POST /api/auth/refresh
POST /api/auth/logout

How to use

  1. Clone this project
git clone https://github.com/reptr/laravel-jwt-auth /direktori project(htdoc)
  1. Create database

  2. Edit .env

DB_DATABASE= (fill database)
DB_USERNAME= (fill username)
DB_PASSWORD= (fill password)
  1. Composer Install
composer install
  1. Migrate database
php artisan migrate
  1. Generate Key
php artisan key:generate
  1. Generate Secret Key JWT
php artisan jwt:secret

After generated, you can check this key inside the .env file

  1. Finally, Running app
php artisan serve

Screenshoot

  1. User Registration

  1. Login

  1. User Profile

    Make sure fill token the header field Authorization: Bearer Token

  1. JWT Token Refresh

    Make sure fill token the header field Authorization: Bearer Token

  1. Logout

    Make sure fill token the header field Authorization: Bearer Token

License

MIT License © 2021