log failures and some other actions
[authserver.git] / resource.php
1 <?php
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4  * You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 // Simple server based on https://bshaffer.github.io/oauth2-server-php-docs/cookbook
7
8 // Include the common auth system files (including the OAuth2 Server object).
9 require_once(__DIR__.'/authsystem.inc.php');
10
11 // Handle a request to a resource and authenticate the access token
12 if (!$server->verifyResourceRequest(OAuth2\Request::createFromGlobals())) {
13     $server->getResponse()->send();
14     die;
15 }
16 echo json_encode(array('success' => true, 'message' => 'You accessed my APIs!'));
17
18 ?>