joy2fun / sp-simple-jwt

JSON web tokens

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#JWT on PHP

##Disclaimer

By no means should this code ever be used in production ready applications nor be executed on production servers. No security checks and/or validations were enforced. This code was written for educational purposes only, having the scope to showcase basic functionality. Performance, efficiency, security, or reusability were not a priority.

##Install

Run composer install to install all the library dependencies.

Please create a config file config/config.php with the desired signing key and your MySQL database credentials. You can use the file config/config.php.dist as a template.

Additionally create the following table in your database:

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(255) NOT NULL,
  `password` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

id and username fields should be pretty straight forward. The password field has to be generated using the password_hash() function in PHP

About

JSON web tokens


Languages

Language:PHP 46.5%Language:HTML 28.2%Language:JavaScript 21.6%Language:CSS 3.1%Language:ApacheConf 0.7%