Reputation: 9268
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
Upvotes: 0
Views: 1179
Reputation: 4798
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.)
Upvotes: 1