Example usage of AX in PHP OpenID -


I am using Jennren's PHP OpenID library. This example comes with a script which is using the SRAGP extension. But I want to work with Google (and it actually works for the author), but Google uses AX (specialty exchange) instead of SRAG for additional data, for some reason, in JanRain's Library Ax support is not in the example script, and code comments in Ax Script are out of my mind, though the comments in the SReg script are as clear 1-2-3.

Do anyone know how to execute AX without pain?

A few excavations in AX.php participated in the same problem I got a job start. Not tested for any bugs, nor testing beyond basic, nor tested with anyone other than Google. It is not beautiful: error management is required, but it should start you. If I have something strong I can post updates ...

Throw first ...

  // oid_request.php // just with this For testing / Google, others need to try ... $ oid_identifier = 'https://www.google.com/accounts/o8/id'; // Required files are required "at / open id / consumer.fp"; Need_once "Auth / OpenID / FileStore.php"; Need_once "Auth / OpenID / AX.php"; // session start (required for YADIS) session_start (); // Create open file storage area for OpenID data $ store = new Auth_OpenID_FileStore ('./ oid_store'); // Create OpenID Consumer $ Consumer = New Auth_OpenID_Consumer ($ Store); // OpenID Provider $ auth = $ consumer- & gt; Create an authentication request for start ($ oid_identifier); // Create Specialty Request Object // http://code.google.com/apis/accounts/docs/OpenID.html# Parameters for Parameter // Usage: Make ($ type_very, $ count = 1, $ required = false , $ Alias ​​= null) $ attribute [] = Auth_OpenID_AX_AttrInfo :: make ('http://axschema.org/contact/email'2,1,' email '); $ Attribute [] = Auth_OpenID_AX_AttrInfo :: make ('http://axschema.org/namePerson/first',1,1,' first name '); $ Attribute [] = Auth_OpenID_AX_AttrInfo :: make ('http://axschema.org/namePerson/last'1,1,' last name '); // Request to fetch AX $ ax = new Auth_OpenID_AX_FetchRequest; // Request to fetch AX foreach (attribute $ attr $ attribute) {$ ax- & gt; Plus ($ attr); } // Request a valid authentication request to fetch $ auth- & gt; AddExtension ($ ax); // authentication $ url = $ auth-> Redirecting to the openURL provider for redirectURL ('http: // localhost: 4001', 'http: // localhost: 4001 / oid_catch.php');); Header ('location:'. $ Url);  

... and then to catch

  & lt ;? Php // oid_catch.php // must include the necessary files "Authentication / OpenID / Consumer.php"; Need_once "Auth / OpenID / FileStore.php"; Need_once "Auth / OpenID / AX.php"; // session start (required for YADIS) session_start (); // Create open file storage area for OpenID data $ store = new Auth_OpenID_FileStore ('./ oid_store'); // Create OpenID Consumer $ Consumer = New Auth_OpenID_Consumer ($ Store); // OpenID Provider $ auth = $ Consumer- & gt; Create an authentication request for full ('http: // localhost: 4001 / oidk .fp'); If ($ response-> position == Auth_OpenID_SUCCESS) {// registration information $ ax = new Auth_OpenID_AX_FetchResponse (); $ Obj = $ ax- & gt; Sesosospons ($ response); // print me the raw echo '& lt; Pre & gt; '; Print_r ($ obj- & gt; data); Echo & lt; / Pre & gt; '; Go out; } And {// failed}  

These are the basics ...


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -