2017 © Pedro Peláez
 

library sopx-auth-v1_1

SOP v1.1 authentication

image

researchpanelasia/sopx-auth-v1_1

SOP v1.1 authentication

  • Monday, March 7, 2016
  • by yowcow
  • Repository
  • 23 Watchers
  • 1 Stars
  • 388 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 2 % Grown

The README.md

Build Status, (*1)

NAME

SOPx_Auth_V1_1 - SOP v1.1 authentication module, (*2)

SYNOPSIS

$auth = new \SOPx\Auth\V1_1\Client('<APP_ID>', '<APP_SECRET>');

$request = $auth->createRequest(
  'GET', 'https://<API_HOST>/path/to/endpoint',
  array('app_id' => '<APP_ID>', 'app_mid' => '<APP_MID>', ... )
);
//=> isa GuzzleHttp\Psr7\Request object

OR, (*3)

$sig = \SOPx\Auth\V1_1\Util::createSignature(
  array(
    'app_id' => '<APP_ID>',
    'app_mid' => '<APP_MID>',
    'time' => $time,
    ...
  ), '<APP_SECRET>'
);
//=> HMAC SHA256 hash signature

DESCRIPTION

This module enables you to generate SOP v1.1 signature, make HTTP request to SOP v1.1 API., (*4)

HOW TO USE

Making a valid request to SOP API endpoint

  $auth = new \SOPx\Auth\V1_1\Client('<APP_ID>', '<APP_SECRET>');

  $request = $auth->createRequest(
    'GET',
    'https://<API_HOST>/path/to/endpoint',
    array(
      'param1' => 'foo',
      'param2' => 'bar',
      ...
    )
  );

  // Then use Guzzle HTTP client to send request

Creating a valid URL (e.g., for JSONP request)

  $auth = new \SOPx\Auth\V1_1\Client('<APP_ID>', '<APP_SECRET>');

  $request = $auth->createRequest(
    'GET',
    'https://<API_HOST>/path/to/jsonp/endpoint',
    array(
      'param1' => 'foo',
      'param2' => 'bar',
      ...
    )
  );

  // Then maybe in your HTML template:
  <script src="<?php echo $request->getUri(); ?>"></script>

Sending various request types

GET

  $request = $auth->createRequest('GET', (string) $url, (array) $params)

POST

For type application/x-www-form-urlencoded, (*5)

  $request = $auth->createRequest('POST', (string) $url, (array) $params)

For type application/json, (*6)

  $request = $auth->createRequest('POSTJSON', (string) $url, (array) $params)

DELETE

  $request = $auth->createRequest('DELETE', (string) $url, (array) $params)

PUT

For type application/x-www-form-urlencoded, (*7)

  $request = $auth->createRequest('PUT', (string) $url, (array) $params)

For type application/json, (*8)

  $request = $auth->createRequest('PUTJSON', (string) $url, (array) $params)

Verifying a request signature for validity

  $auth = new \SOPx\Auth\V1_1\Client('<APP_ID>', '<APP_SECRET>');

  $sig = $params['sig'];
  unset($params['sig']);

  if ($auth->verifySignature($sig, $params)) {
    // Request is valid
  }
  else {
    // Request is invalid
  }

request types defined in SOP v1.1 Authentication., (*9)

The Versions

07/03 2016

dev-master

9999999-dev https://github.com/researchpanelasia/php-sopx-auth-v1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yowcow

authentication sop

07/03 2016

1.0.0

1.0.0.0 https://github.com/researchpanelasia/php-sopx-auth-v1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yowcow

authentication sop

07/03 2016

dev-legacy

dev-legacy https://github.com/researchpanelasia/php-sopx-auth-v1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

07/03 2016

0.0.8

0.0.8.0 https://github.com/researchpanelasia/php-sopx-auth-v1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

14/11 2014

0.0.7

0.0.7.0 https://github.com/researchpanelasia/php-sopx-auth-v1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

14/11 2014

0.0.6

0.0.6.0 https://github.com/researchpanelasia/php-sopx-auth-v1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

16/10 2014

0.0.5

0.0.5.0 https://github.com/researchpanelasia/php-sopx-auth-v1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

16/10 2014

0.0.4

0.0.4.0 https://github.com/researchpanelasia/php-SOPx-Auth-V1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

16/10 2014

0.0.3

0.0.3.0 https://github.com/researchpanelasia/php-SOPx-Auth-V1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

16/10 2014

0.0.2

0.0.2.0 https://github.com/researchpanelasia/php-SOPx-Auth-V1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop

16/10 2014

0.0.1

0.0.1.0 https://github.com/researchpanelasia/php-SOPx-Auth-V1_1

SOP v1.1 authentication

  Sources   Download

MIT

The Requires

 

The Development Requires

by yowcowvg

authentication sop