PHP code example of stefna / islandis-auth

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

    

stefna / islandis-auth example snippets



if (isset($_POST['token'])) {
	$audienceUrl = 'login.example.com';
	$authentication = new Islandis\Authenticate(new \Islandis\Verifier($audienceUrl));
	try {
		$user = $authentication->verify($_POST['token']);
		$kennitala = $user->getKennitala();
		//is authenticated
	} catch (\Islandis\Exception\AuthenticateError $e) {
		echo $e->getMessage();
		//failed  authentication
	}
}