开发者

OpenID like Stack Overflow

I want to create an OpenID login with PHP just like it can be found on Stack Overflow.

I know there are many questions for this, but mine is different.

If I understood it correctly, every OpenID is defined by a unique URL. But: If I hit the Google button on the Stack Overflow login page, one generic URL is inserted in the text field. Is this the direct URL to the OpenID server? And if it is, how do I have to pass the URL to thi开发者_C百科s class?


In the OpenID specs (section 7.3.1) it says

For the purposes of making OpenID Authentication requests, the value "http://specs.openid.net/auth/2.0/identifier_select" MUST be used as both the Claimed Identifier and the OP-Local Identifier when an OP Identifier is entered.

Now what this basically means is that instead of using a "User specific OpenID URL" you can use a generic URL and simply specify that the Identity provider should provide in the return what the actual OpenID URL of the user is.

Note that this is a feature of OpenID 2.0! A lot of libraries out there are still OpenID 1.x

HTH


You can't authenticate with Google using SimpleOpenID. That library supports only OpenID 1.1, while Google supports only OpenID 2.0.


To go with the other answers that SimpleOpenID doesn't work with google. I've used http://gitorious.org/lightopenid for a project recently and it does work (and includes an example for google).

The library works fine in php5 with full errors/warnings enabled.


The OpenID process consists of several steps. The first is redirecting the browser to the OpenID provider, then the user comes back to your page and you get some information about him.

Among the returned information, his OpenID is provided. This is the OpenID you are looking for, not the one the user wrote into your text field.

This "OpenID" is only used to discover the Identity Provider, nothing more. This is the reason you can simply put yahoo.com into an OpenID box and can log in with yahoo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜