A package for push authorization
PHP push authorization, (*1)
=======, (*2)
PHP 5.6 and later., (*4)
You can install the bindings via Composer. Run the following command:, (*5)
composer require pushauth/pushauth-php
To use the bindings, use Composer's autoload:, (*6)
require_once('vendor/autoload.php');
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file., (*7)
require_once('/path/to/pushauth-php/pushahuth.php');
The bindings require the following extension in order to work properly:, (*8)
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available., (*9)
Simple usage looks like:, (*10)
use PushAuth\PushAuth; //Setting your Public & Private keys $authRequest = new PushAuth('publicKey', 'privateKey');
And waiting responce from client until 30 sec:, (*11)
$request = $authRequest->to('client@yourfirm.com') ->mode('push') ->response(false) ->send(); if ($authRequest->isAccept()) { //Make logIn action... } else { //Make Access Denied action... }
Or custom wait 10 seconds response with self check:, (*12)
$request = $authRequest->to('client@yourfirm.com') ->mode('push') ->response(true) ->send(); $sec = 1; while ($sec <= 10) { if ($authRequest->isAccept()) { //Make LogIn action } $sec++; sleep(1); } if ($authRequest->isAccept() == false) { //Make Access Denied action } if ($authRequest->isAccept() == Null) { //No answer from client }
Special security code to client device:, (*13)
$request = $authRequest->to('client@yourfirm.com') ->mode('code') ->code('123-456') ->send();
To all clients together and wait response:, (*14)
$request = $authRequest->to([ ['1'=>'client.one@yourfirm.com'], ['1'=>'client.two@yourfirm.com'], ['1'=>'client.three@yourfirm.com'] ]) ->response(false) ->send();
All clients recieve push and request will be true only if all clients answering true., (*15)
To all clients by order:, (*16)
$request = $authRequest->to([ ['1'=>'client.one@yourfirm.com'], ['2'=>'client.two@yourfirm.com'], ['3'=>'client.three@yourfirm.com'] ]) ->send(); if ($authRequest->isAccept()) { //Make LogIn action } if ($authRequest->isAccept() == false) { //Make Access Denied action } if ($authRequest->isAccept() == Null) { //No answer from client }
The first client receive push and the next client will receive push only if previous answer true. All request will be true, only if all clients answered true., (*17)
At any time you can view request status:, (*18)
$request = $authRequest->to('client@yourfirm.com') ->mode('push') ->send(); //show request hash print_r($request); // will return Request Hash ex. 1232dwfef31x4xfcf34c2x4 //Show push request information print_r($authRequest->requestStatus($request)); /* will return array: ['answer'=>true, 'response_dt'=>'Time....', 'response_code'=>200, 'response_message'=>'Success answer received'] */
Generate QR-code for client reading and auth:, (*19)
$qr_url = $authRequest->qrconfig([ 'margin'=>'5', 'size'=>'256', 'color'=>'121,0,121' ])->qr(); if ($authRequest->isAccept()) { //Make LogIn action } if ($authRequest->isAccept() == false) { //Make Access Denied action } if ($authRequest->isAccept() == Null) { //No answer from client }
Please see: https://dashboard.pushauth.io/api/index.html, (*20)
Please see: http://dashboard.pushauth.io/support/request/create, (*21)