Skip to content

Php Samples

HostMyCalls edited this page Apr 23, 2019 · 5 revisions

This tutorial assumes you already have:

  • PHP 5.4 or greater
  • CURL extension
  • JSON extension

Install library using composer composer require jumbojett/openid-connect-php Include composer autoloader require __DIR__ . '/vendor/autoload.php';

Then, to access our OpenId Server

use Jumbojett\OpenIDConnectClient;

$oidc = new OpenIDConnectClient('https://hmcopenidserver.azurewebsites.net', 'Test',
'Test'); $oidc->providerConfigParam(array('token_endpoint'=>'https://hmcopenidserver.azurewebsites.net/connect/token')); $oidc->addScope('OperationTimes'); // name of api -> change it according to the API accessed

// this assumes success (to validate check if the access_token property is there and a valid JWT) : $clientCredentialsToken = $oidc->requestClientCredentialsToken()->access_token;

More info at : https://github.com/jumbojett/OpenID-Connect-PHP