Git Product home page Git Product logo

oneid-php-sdk's Introduction

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", "oneid_demo/login.php", "localhost") // This inserts the sign-in button ?>

In the OneID_Button function, pass in the the target destination for new users followed by the target for an existing user who is signing in. These should be PHP destinations on your website. This example uses the same destination target for both cases: oneid_demo/login.php.

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['EMAIL']['VALUE'];
// Return the response 
echo OneID_Redirect('account.php');

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

oneid-php-sdk's People

Contributors

jgoldberg avatar

Stargazers

steve withington avatar

Watchers

steve withington avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.