Download the PHP package glauberkyves/phalcon-jwt-auth without Composer
On this page you can find all versions of the php package glauberkyves/phalcon-jwt-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download glauberkyves/phalcon-jwt-auth
More information about glauberkyves/phalcon-jwt-auth
Files in glauberkyves/phalcon-jwt-auth
Package phalcon-jwt-auth
Short Description A simple JWT middleware for Phalcon Micro to handle stateless authentication
License
Informations about the package phalcon-jwt-auth
phalcon-jwt-auth
A simple JWT middleware for Phalcon Micro to handle stateless authentication.
Installation
or in your composer.json
then run
Usage
Configuration - Loading the config service
in config.ini or in any config file
in bootstrap or index file
Configuration - Don't want to use a config file? then pass the config instead
in bootstrap or index file
Authentication
To make authenticated requests via http, you will need to set an authorization headers as follows:
or pass the token as a query string
Callbacks
By default if the authentication fails, the middleware will stop the execution of routes and will immediately return a response of 401 Unauthorized. If you want to add your own handler:
If you want an additional checking on the authentication, like intentionally expiring a token based on the payload issued date, you may do so:
The Auth service
You can access the middleware by calling the "auth" service.
If you want to change the service name:
Creating a token
In your controller or route handler
Accessing the authenticated user / data
In your controller or route handler
Extending
If you want to add your own middleware or play around:
JWT
Phalcon JWT Auth uses the Firebase JWT library. To learn more about it and JSON Web Tokens in general, visit: https://github.com/firebase/php-jwt https://jwt.io/introduction/
Tests
Install PHPUnit https://phpunit.de/getting-started.html