PHP code example of flandera / open_id_connect_client_52

1. Go to this page and download the library: Download flandera/open_id_connect_client_52 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/ */

    

flandera / open_id_connect_client_52 example snippets




$oidc = new JumbojettOpenIDConnectClient('https://id.provider.com', 'ClientIDHere', 'ClientSecretHere');
$oidc->setCertPath('/path/to/my.cert');

$oidc = new JumbojettOpenIDConnectClient('https://id.provider.com',
                                'ClientIDHere',
                                'ClientSecretHere');
$oidc->providerConfigParam(array('token_endpoint'=>'https://id.provider.com/connect/token'));
$oidc->setRedirectURL('path/where_to_send/response');
$oidc->addScope('my_scope');
//Send authorization information i.e. username and password via form to auth endpoint
//get code and state from GET response of auth endpoint if success
$_SESSION['openid_connect_state'] = $_GET['state'];
$oidc->authenticate();
//if autentization is succesfull retrive token from response
$token = $oidc->getTokenResponse();
//get identity from response JWT payload
$identity = $oidc->getIdTokenPayload()->identity;
//Or use other workflow according to OpenID documentation

$oidc->setVerifyHost(false);
$oidc->setVerifyPeer(false);

composer