Using Your Own URL as Your OpenID with WordPress
Today I decided to join stackoverflow.com, which requires you to login using OpenID.
It was pretty simple to get signed up with myopenid.com, but while I was on the stackoverflow login page I noticed a little message which I found interesting:
Use your own URL
Want to add OpenID support to your website?
It’s as easy as adding two HTML header tags!
It basically would mean I could use “hm2k.com” instead of “hm2k.myopenid.com” to login with OpenID, which is pretty neat. There’s also a section in the help on myOpenID.com for using your own domain, which confirms this.
Seems easy enough, I thought. Then I took into consideration that I’m using wordpress, sure not a major problem, I can simply hard code it into my theme, but then do I really want to do that? No, of course not.
WordPress is renound for it’s ability to be compltely dynamic, I want to stick in line with that. More importantly, I want my OpenID URL to work regardless of what theme I’m using.
So I decided to start looking into it. I soon discovered someone over at wordpress.com had the same idea and had requested a way to add OpenID delegation link to head.
At first I thought about getting a plugin that would inject the required lines of HTML into the head, however after some quite extensive research I found what I was looking for…
The WordPress OpenID Plugin allows users authorized to use the OpenID Provider can delegate to a different provider, among other things.
Once you have installed and activated the plugin you need to do the following:
- Go to the OpenID settings page (/wp-admin/options-general.php?page=openid)
- Set the “Blog Owner” as yourself, and click “Save Changes”.
- Go to your profile (/wp-admin/profile.php) and scroll to the bottom where it says “OpenID Delegation”.
- In the edit box you would provide your OpenID URL (ie: http://hm2k.myopenid.com/)
Now when I check the source code of my site I see the following HTML in the <head>:
<link rel=”openid2.provider” href=”http://www.myopenid.com/server” />
<link rel=”openid2.local_id” href=”http://hm2k.myopenid.com/” />
<link rel=”openid.server” href=”http://www.myopenid.com/server” />
<link rel=”openid.delegate” href=”http://hm2k.myopenid.com/” />
Perfect!
I hope you find this as useful as I have.