jaredhanson / passport-openid

OpenID authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-openid/?utm_source=github&utm_medium=referral&utm_campaign=passport-openid&utm_content=about
MIT License
98 stars 85 forks source link

Failed to discover OP endpoint URL(nodejs v0.10.x) #14

Closed reutopiaer closed 11 years ago

reutopiaer commented 11 years ago

Failed to discover OP endpoint URL (message: No usable providers found for the given identifier) at node_modules/passport-openid/lib/passport-openid/strategy.js:249:52 at successOrNext (node_modules/passport-openid/node_modules/openid/openid.js:885:16) at node_modules/passport-openid/node_modules/openid/openid.js:901:13 at node_modules/passport-openid/node_modules/openid/openid.js:699:14 at done (node_modules/passport-openid/node_modules/openid/openid.js:302:9) at IncomingMessage. (node_modules/passport-openid/node_modules/openid/openid.js:306:32) at IncomingMessage.EventEmitter.emit (events.js:117:20) at _stream_readable.js:872:14 at process._tickCallback (node.js:415:13)

fix openid's bug " has no method 'charCodeAt' " at v0.10.1: https://github.com/havard/node-openid/issues/95

reutopiaer commented 11 years ago

sorry,I found it's not a bug. just use "stateless: true" see: https://github.com/jaredhanson/passport-openid/issues/1

victorquinn commented 11 years ago

For anyone else that comes across this, I was banging my head against the wall for the better part of a day until I discovered this passport-openid module wouldn't work for me on node v0.10. The "stateless: true" trick from above didn't do it for me.

However, switching to node v0.8 fixed it instantly for me with no other changes to my code.

jaredhanson commented 11 years ago

Can you provide any further details? It should be working on v0.10, and if there is any problem it should be fixed.

victorquinn commented 11 years ago

I was getting the exact same error as shown above ("Failed to discover OP endpoint URL") and was troubleshooting it forever, trying to step through the code line by line and it was just dying somewhere and never even making it to the Provider.

As a last ditch effort, I noticed that in the travis file for this module, it was only testing the code against node v0.6 and v0.8 so I tried switching to v0.8 and everything worked like a charm without changing anything in my code.

So it now works with node v0.8, if I switch it back to v0.10 in my package.json it breaks again, then switching back to v0.8 it works fine again. So this is definitely the solution someway somehow.

Apologies, I know this isn't a whole lot of info to go on, I'm rushing toward a deadline and will circle back and try to give you more details if I can find any but wanted to post this in case it's useful to anyone else.

habicm commented 11 years ago

After deal with this problem for couple of days found these two issues:

  1. On the openid.js file in _get function

var options = { host: getUrl.hostname, port: isDef(getUrl.port) ? parseInt(getUrl.port, 10) : (getUrl.protocol == 'https:' ? 443 : 80), headers: { 'Accept' : 'application/xrds+xml,text/html,text/plain,/_' }, path: path };

Some times getUrl.port is null and _isDef is just taking care of the undefined, this could lead to weird port information.

  1. RejectUnauthorized default value has been changed on node 0.10.5?, maybe you should open a new option to allow to set this options.

Thanks

ikhomyakov commented 10 years ago

Has passport-openid been ported to node v0.10?

nfriedly commented 9 years ago

This is getting me too - the tricky part is that it works on my laptop, but fails on my server after I deploy it, so it's a lot harder to debug than most things.

Update: never mind - I figured out my issue: the OpenID provider I was authenticating against is only accessible within my company's network or VPN. My laptop could hit it, but my server (and the rest of the internet) couldn't.