diuitapi / php-session-helper
Diuit Session Token Helper, to make easier the session token creating process
0.1.3
2016-03-08 11:12 UTC
Requires
- php: >=5.4.0
- lcobucci/jwt: ^3.1
This package is not auto-updated.
Last update: 2025-01-04 20:25:51 UTC
README
A simple PHP library to help you authenticate your devices from backend easier. It returns session token, which you have to pass to your device and login with it.
Installation
Package is available on Packagist, you can install it using Composer.
composer require diuitapi/php-session-helper
Dependencies
- PHP 5.4+
Basic usage
Getting session token
Just use the DiuitTokenHelper to get a session token:
use Diuit\DiuitTokenHelper; $session = (new DiuitTokenHelper())->setAppId('your_app_id') // Configures app ID ->setAppKey('your_app_key') // Configures app key ->setKeyID('your_key_id') // Configures key id for finding public key ->setPrivateKey('file://your_pem_file_path') // Configures private key (you can either use file path or plain text) ->setUserSerial('user_serial') // Configures user serial ->setExpDuration(7*24*3600) // Configures length of session valid duration (in seconds), example is in length of a week ->getSessionToken('your_device_serial', 'gcm', 'device_push_token'); // Configures device serial, platform and push token(optional) and retrieves session token echo $session; // will print session token
And then ... ?
Pass the session token you got here to your client (may be an app or browser), and login your client with it for using more features of Diuit Messaging API.