Пример #1
0
<?php

/**
 * @todo Put this in its own class, and make it more flexible.  Also, replace sha1() in Pdo class which stores and retrieves user passwords.  Use PHP's built in hashing functionality.  http://php.net/manual/en/function.password-hash.php
 */
/**
 * Assorted notes
 * https://github.com/bshaffer/oauth2-server-php/issues/377
 * https://github.com/bshaffer/oauth2-server-php/issues/592
 */
require_once 'vendor/bshaffer/oauth2-server-php/src/OAuth2/Autoloader.php';
OAuth2\Autoloader::register();
$dsn = 'mysql:dbname=oauth;host=localhost';
$username = '******';
$password = '******';
ini_set('display_errors', 1);
error_reporting(E_ALL);
$storage = new OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password));
$result = $storage->setUser('swos', 'asdfjkl', 'John', 'Austin');
var_dump($result);
Пример #2
0
<?php

/**
 * @todo Put this in its own class, and make it more flexible.
 */
require_once 'vendor/bshaffer/oauth2-server-php/src/OAuth2/Autoloader.php';
OAuth2\Autoloader::register();
$dsn = 'mysql:dbname=oauth;host=localhost';
$username = '******';
$password = '******';
ini_set('display_errors', 1);
error_reporting(E_ALL);
$storage = new OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password));
$result = $storage->setClientDetails('TestClient');
var_dump($result);