Download the PHP package wirecore/cakephp_jwt without Composer
On this page you can find all versions of the php package wirecore/cakephp_jwt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wirecore/cakephp_jwt
More information about wirecore/cakephp_jwt
Files in wirecore/cakephp_jwt
Package cakephp_jwt
Short Description CakePHP plugin for authenticating users by JSON Web Tokens
License MIT
Homepage https://github.com/WireCore/CakePHP-JWT-Plugin
Informations about the package cakephp_jwt
CakePHP_JWT
CakePHP_JWT is a Plugin for CakePHP 4 that allows you to authenticate users by JSON Web Tokens
Installation
Use the package manager composer to install CakePHP_JWT.
Usage
First you need to load the plugin in the Application.php of your project.
After the plugin was loaded you need to load the JWT component of the plugin.
This was all what you need. All actions are now authentication protected.
Optional you can set some component configuration.
Methods
To allow actions unauthenticated use this:
The Plugin matches automaticly a user by the transferd JWT Token. To get this User use:
To generate a new access token use this:
To generate a new refresh token use this:
To set the refresh token cookie use this. The method generate a new refresh token.
To refresh access and refresh token use this method:
Best Practise
Here is a example of a AuthController that you can use. You must change a bit things but the basic concept should be the same
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Development Setup
In the root folder you find a docker-compose file what you can use to develop the plugin. Follow the introduction at the installation section, and change the following lines in the composer.json of the cakephp installation.
After adding the previous lines you need to run in the php-fpm container.
In addition you find a .devcontainer folder in the project that is recommended for development in VS Code.