This tutorial uses a small PHP library that implements the relevant calls to the OneID web services.
To use the demos without modification, you will also need to download an API Key from https://keychain.oneid.com/register into the same directory as the demo. Name the api key file api_key.json. By downloading the API Key you agree to the OneID Developer Agreement. The API Key gives you access to OneID Helper Services, which is not required, but is used in the example code. Without the Helpers Services, you will need to validate credentials and create nonces on your own.
If you have any questions, join us on #OneID on Freenode.
Implementing OneID sign-in is a three step process, one for each page on your server. On the page where you want the sign-in button, you include a script tag and place the login button. The PHP library has helper variables and functions to make this simple:
<?php require ("oneid.php"); ?> <?php echo $oneid_script; // This inserts the script tag ?> <?php echo OneID_Button("verify.php") // This inserts the sign-in button ?>
In the OneID_Button function, pass in the the target destination that you host for verifying the credentials provided by OneID and linking the OneID to the current user. These should be PHP destinations on your website.
verify.php is called by the OneID client during the authentication ceremony. The code is:
account.php is the destination where you want the client’s browser to be sent after signing in successfully.