Commit c89f2369 authored by Daniel Carden's avatar Daniel Carden

Update oauth2-server.php

parent de7f1bb2
Pipeline #523 failed with stage
<?php
$dsn = 'mysql:dbname=lmce_oauth2_db;host=localhost';
$username = 'root';
$password = '';
......@@ -9,8 +10,8 @@ ini_set('display_errors',1);error_reporting(E_ALL);
require_once('include/OAuth2/Autoloader.php');
OAuth2\Autoloader::register();
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
$storage = new OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password));
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhos$
$storage = new OAuth2\Storage\Pdo(array('dsn' => $dsn, 'username' => $username, 'password' => $password$
// Pass a storage object or array of storage objects to the OAuth2 server class
$server = new OAuth2\Server($storage);
......@@ -20,3 +21,10 @@ $server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
// Add the "Authorization Code" grant type (this is where the oauth magic happens)
$server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage));
// Add the "Refresh Token" grant type
$server->addGrantType(new OAuth2\GrantType\RefreshToken($storage, array(
'always_issue_new_refresh_token' => true,
'refresh_token_lifetime' => 2419200
)));
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment