Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to distinguish/identify users with OpenID without requesting SReg fields?
    text
    copied!<p>I've been toying with the JanRain OpenID PHP Library, mostly following along with <a href="http://devzone.zend.com/article/3581" rel="nofollow noreferrer">a tutorial I found on ZendZone</a>.</p> <p>How does one distinguish between users - especially Google users, who all end up using the same OpenID URL, <a href="https://www.google.com/accounts/o8/id" rel="nofollow noreferrer">https://www.google.com/accounts/o8/id</a> ?</p> <p>Basically, I'm at the point where I can detect that they have an OpenID account... that they've successfully authenticated... but my app still doesn't know who they are; only that they authenticated.</p> <p>To distinguish users, the tutorial uses a "Simple Registration request" to request the user's email of the OpenID provider - and then use email address to see if this is a returning user.</p> <p>It wasn't working for me, and <a href="https://stackoverflow.com/questions/2459565/janrain-openid-in-php-sreg">apparently won't work with some providers</a> so I was excited when I stumbled upon a function <code>getDisplayIdentifier</code>.</p> <pre><code>require_once "Auth/OpenID/Consumer.php"; require_once "Auth/OpenID/FileStore.php"; // create file storage area for OpenID data $store = new Auth_OpenID_FileStore('/wtv'); $consumer = new Auth_OpenID_Consumer($store); $oid_response = $consumer-&gt;complete("http://example.com/oir_return"); if ($oid_response-&gt;status == Auth_OpenID_SUCCESS) { $hopefullyUniqueUserID = $oid_response-&gt;getDisplayIdentifier(); // I assumed this would be a relatively permanent way to identify the user... // I was wrong. } </code></pre> <p>Unfortunately, after a couple of hours the value returned by <code>getDisplayIdentifier</code> changes.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload