PHP code example of xibosignage / oauth2-xibo-cms
1. Go to this page and download the library: Download xibosignage/oauth2-xibo-cms library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xibosignage / oauth2-xibo-cms example snippets
$provider = new \Xibo\OAuth2\Client\Provider\Xibo([
'sandbox' => "TRUE_OR_FALSE",
'clientId' => "YOUR_CLIENT_ID",
'clientSecret' => "YOUR_CLIENT_SECRET",
'responseType' => "JSON_OR_STRING"
'redirectUri' => "http://your-redirect-uri"
]);
$token = $provider->getAccessToken('refresh_token', [
'grant_type' => 'refresh_token',
'refresh_token' => "REFRESH_TOKEN"
]);
// OR (to get the token)
$token = $this->provider->getAccessToken("authorizaton_code", [
'code' => $_GET['code']
]);
// pass the token to the headers
$provider->headers = ['Authorization' => 'Bearer ' . $token];