Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.
/ example-php-jwt Public archive

Lightweight PHP implementation of JWT authentication without external dependencies. Features HMAC and RSA signing, token validation, claim verification, expiration handling, and refresh token support for secure web applications.

Notifications You must be signed in to change notification settings

aashari/example-php-jwt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT Wih Native PHP

This is a very simple implementation of JWT (JSON Web Token) using native PHP, jQuery, and firebase/php-jwt package


Documentation

file explanation

/composer.json

This file will handler your composer package

/src/server/doGetToken.php

This file will receive a username and password using POST method, and then validate the username and password, if authenticated then return the JWT Token, if not authenticated then return the error message

/src/server/doValidateToken.php

This file will validate a token for every request made from client (if you include this file in every php script requires token), if not validated then return an error message, if validated then return the requested resource

/src/server/doGetData.php

This is the example of endpoint to get the data resource needed by the client side, this file will require doValidateToken.php file.

/src/index.html

This file contains a simple login form that will send an username and password using post method to the server.

/src/home.html

This is a very simple client that request a data from the server and then update a token for every response by the server.

About

Lightweight PHP implementation of JWT authentication without external dependencies. Features HMAC and RSA signing, token validation, claim verification, expiration handling, and refresh token support for secure web applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published