Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
OneID PHP SDK
branch: rel1_5

This branch is even with OneID:rel1_5

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples/oneid_demo
.gitignore
README.markdown
oneid.php

README.markdown

About

This tutorial uses a small PHP library that implements the relevant calls to the OneID web services.

If you have any questions, join us on #OneID on Freenode.

Implementing

Implementing OneID sign-in is a two-step process. On the page where you want the sign-in button, you must include a script tag and decide where to place the 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("oneid_demo/login.php") // This inserts the sign-in button ?>

In the OneID_Button function, pass in the the target destination that you host for logging in or registering a new user on your site. These should be PHP destinations on your website.

oneid_demo/login.php is a file that handles the response when the user clicks the OneID button. The code is:

<?php 
require ("oneid.php");
$attrs = OneID_Response(); // This function handles validation of
                            // the response from OneID and returns an 
                            // array of attributes for the user.
// Local code to "log in" the user
session_start();
$_SESSION['email'] = $attrs['attr']["personal_info"]['email'];  
// Return the response 
echo OneID_Redirect('account.php'); // Redirect the user after a successful local authentication

account.php is the destination where you want the client’s browser to be sent after signing in successfully.

Something went wrong with that request. Please try again.