Commit 4780ad68 authored by Daniel Carden's avatar Daniel Carden

Delete server.php

parent 48a103c5
Pipeline #521 canceled with stage
//this is the api that grants access to the incoming web app.
//test db is assumed setup already.
$dsn= 'mysql:dbname=oauth2_db;host=localhost';
$username = "root";
$password = "";
ini_set('display_errors', 1); error_reporting(E_ALL);
// $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));
// Pass a storage object or array of storage objects to the OAuth2 server class
$server = new OAuth2\Server($storage, array(
'allow_implicit' => true,
// create the grant type
$grantType = new OAuth2\GrantType\RefreshToken($storage);
// add the grant type to your OAuth server
// Add the "Client Credentials" grant type (it is the simplest of the grant types)
$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));
$defaultScope = 'basic';
$supportedScopes = array(
$memory = new OAuth2\Storage\Memory(array(
'default_scope' => $defaultScope,
'supported_scopes' => $supportedScopes
$scopeUtil = new OAuth2\Scope($memory);
\ 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