views:

162

answers:

1

Hello,

I'm getting a "No matching endpoint found after discovering [openid identifier]" error when I invoke complete() method of the consumer.

The funny thing is that out of the four OpenID providers I have tested, this behavior is observed only with LiveJournal. What steps can you suggest to investigate and fix the problem?

store = FileOpenIDStore("/path/to/store")

def login(req, uri):
    req.content_type = "text/html"
    session = Session.Session(req)
    consumer = Consumer(session, store)
    auth = consumer.begin(uri)
    util.redirect(req, auth.redirectURL("http://example.com", "http://example.com/authtest.py?sid=" + session.id()))
    return

def index(req, sid):
    req.content_type = "text/html"
    c = Consumer(Session.Session(req, sid), store)
    args = req.args.split("&")
    arg_dict = {}
    for i in range(0, len(args)):
        x, y = args[i].split("=")
        arg_dict[x] = unquote(y)
    v = c.complete(arg_dict, "http://example.com/authtest.py?" + req.args)
    if v.status == 'failure':
        return v.message
    else:
        return v.status
A: 

I don't see any glaring error in your code, but here are some steps to investigate:

  • Is there any output from oidutil.log? It logs to stderr by default, but you can override it to log to somewhere else if your web server doesn't let you see stderr.

  • Capture all requests/responses. You can use something like TamperData to get the indirect request/response passed through the browser, and feed it to contrib/openid-parse from the python-openid distribution to make it more something readable.

  • Does the example consumer in the python-openid source distribution work with your LJ identifier? If so, what are the differences in request/response between the example and your code?

  • Does your LJ identifier have any punctuation in it?

  • Is LJ the only OpenID version 1.x provider you're testing against? (Probably. Hopefully there aren't too many left.)

  • Your argument parsing could use urlparse.parse_qs, but I'm not sure that's really a problem. (And parse_qs returns {key: [list-of-values]}, whereas Consumer.complete expects {key: single-value}, so you have to map one to the other.)

keturn
Using oidutil.log I have found out that the openID library doesn't check OpenID 1.0, which LJ appears to use; it only checks 1.1 despite the fact that the code for processing 1.0 seems to be there. Investigating.
David Parunakian
I fixed it. As per http://trac.openidenabled.com/trac/ticket/162, in consumer.py the line 986 should look like `except (DiscoveryFailure, TypeURIMismatch):`, because the _discoverAndVerify method raises DiscoveryFailure when a mismatch occurs. Thanks for pointing me in the right direction :)
David Parunakian
Huh. cygnus closed that ticket as `worksforme`. And it works for me too. I wonder what's going on there.
keturn