How do you develop against OpenID locally

Question:

I’m developing a website (in Django) that uses OpenID to authenticate users. As I’m currently only running on my local machine I can’t authenticate using one of the OpenID providers on the web. So I figure I need to run a local OpenID server that simply lets me type in a username and then passes that back to my main app.

Does such an OpenID dev server exist? Is this the best way to go about it?

Asked By: d4nt

||

Answers:

I’m also looking into this. I too am working on a Django project that might utilize Open Id. For references, check out:

Hopefully someone here has tackled this issue.

Answered By: imjoevasquez

I’m using phpMyID to authenticate at StackOverflow right now. Generates a standard HTTP auth realm and works perfectly. It should be exactly what you need.

Answered By: Andrew

Why not run an OpenID provider from your local machine?

If you are a .Net developer there is an OpenID provider library for .Net at Google Code. This uses the standard .Net profile provider mechanism and wraps it with an OpenID layer. We are using it to add OpenID to our custom authentication engine.

If you are working in another language/platform there are a number of OpenID implementation avalaiable from the OpenID community site here.

Answered By: Al.

You could probably use the django OpenID library to write a provider to test against. Have one that always authenticates and one that always fails.

Answered By: Aaron Maenpaa

I have no problems testing with myopenid.com. I thought there would be a problem testing on my local machine but it just worked. (I’m using ASP.NET with DotNetOpenId library).

The ‘realm’ and return url must contain the port number like ‘http://localhost:93359‘.

I assume it works OK because the provider does a client side redirect.

Answered By: tpower

You shouldn’t be having trouble developing against your own machine. What error are you getting?

An OpenID provider will ask you to give your site (in this case http://localhost:8000 or similar) access to your identity. If you click ok then it will redirect you that url. I’ve never had problems with livejournal and I expect that myopenid.com will work too.

If you’re having problems developing locally I suggest that the problem you’re having is unrelated to the url being localhost, but something else. Without an error message or problem description it’s impossible to say more.

Edit: It turns out that Yahoo do things differently to other OpenID providers that I’ve come across and disallow redirections to ip address, sites without a correct tld in their domain name and those that run on ports other than 80 or 443. See here for a post from a Yahoo developer on this subject. This post offers a work around, but I would suggest that for development myopenid.com would be far simpler than working around Yahoo, or running your own provider.

Answered By: Andrew Wilkinson

The libraries at OpenID Enabled ship with examples that are sufficient to run a local test provider. Look in the examples/djopenid/ directory of the python-openid source distribution. Running that will give you an instance of this test provider.

Answered By: keturn
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.