-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InternalOpenIDError: Failed to verify assertion #37
Comments
I got the Also, @atlasdev did you include |
@jennyl Yes I have, but really basic: passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(obj, done) {
done(null, obj);
}); |
Just update all npm packages.. it fixes the problem, the cause of problem is not about this repo.. its about packages. |
Any solutions? I'm stuck. None of the node openid packages work reliably,... |
I tested all examples on the latest version before publishing. And this bug is producible, at least not reliably. |
Done so, even went into the packages to run this command to ensure all packages are up-to-date. Still encountering this error 90% of the time. npm ls (ignore openid being inside passport-steam, drag n drop mistake which doesnt effect anything anyways) Anything you can spot being outdated? edit: |
@notJackson are you using NPM3? |
it works without problems on my project, no idea what is wrong with yours.. |
Update to NPM3, that should fix the issue On Fri, 3 Jun 2016, 23:05 notJackson, notifications@github.com wrote:
|
Thanks for the quick response, if it happens to bug again I will upgrade within a heartbeat. |
Going to leave this issue open for a few more days, if there's no more bug-like activity I'll close it. |
script Still encountering the same error :( The thing is, it sometimes works, but mostly doesnt. I'm frustrated. (Ran npm update in every directory possible at this point btw) |
experiencing the same error. npm version: 3.9.3 |
"curl http://steamcommunity.com/openid" ~4/10 requests are not succesful. Stationed on digital ocean. @mprey Where are you hosting your files? |
@notJackson hosted my files on my local machine and a deployed heroku app with different API keys and experienced the same error on both machines. I am able to retrieve the XML file on my local machine with |
Couple you please follow advice in #31 (comment) and see if that helps, I've got a feeling this is a similar issue. |
@mnzt flushing DNS came out with the same result. I have tried my own source code and welp's in this issue hosted on my own local machine and deployed as a heroku app. I have also tried signing in with two different machines on the heroku app with no avail. I have a feeling there is a version clashing going on, so I am going to test different releases for the package to see what comes. |
after many, many hours of debugging I am pretty sure I found the error. in the signon example provided in the passport-steam source, the example routed the authentication requests using
however, in my app, I was using express's built in Router in order to route authentication requests like so:
when I changed back to using the native app provided by calling express(), passport-steam worked flawlessly and after further testing by switching between the two routing techniques supports my conclusion. any insight on why this may happen would be great since I am fairly new to Node. |
@mprey Thanks for taking the time to debug. I, and I'm sure many others, have used passport via an express router with no issues, although it's interesting to see you're having this issue. |
I am now running the example provided on my server and also experiencing this error. I will try another service and report back. |
I'm having the same issue. |
I was able to fix this for myself. I used express-generator for my project. I have a file named auth.js in the /routes directory that handles the authentication. I export the router variable just like @mprey does. And in the main app.js file I have this:
So basically /auth/steam becomes /auth/auth/steam on the site. When I was doing it like this, I was experiencing the
Now everything works fine. And all of the working examples I've seen have it on |
Can confirm it happens with Router, I use it as well. I will soon (tomorrow, maybe the day after) look into the issue again with a fresh install of everything. |
I try to run the example signon with steam API(https://steamcommunity.com/dev/apikey) domain name http://localhost:3000/. I get an error every time steam API return data.
node: v6.1.0 npm: 3.8.6 package:
I hope someone can help. Thanks in advance |
@kerrop33 use node 4.4.5. I need to see if openid has a working version for node 6 |
Currently getting similar issue { [InternalOpenIDError: Failed to verify assertion]
name: 'InternalOpenIDError',
message: 'Failed to verify assertion',
openidError: { message: 'Invalid return URL' } }
npm version
passport.use('steam', new SteamStrategy(
{
returnURL: 'https://dfrag.tv/auth/steam/return',
realm: 'https://dfrag.tv/',
apiKey: config.get('steamKey'),
passReqToCallback: true
},
function(req, identifier, profile, done)
{
done(null, profile);
}
)); |
@mavrick Can you see if it works with node 4.4.5? If so, then there may be an underlying issue. |
Likely doesn't help that I was still using passport-steam v0.1.6. Thanks. |
i want to custom dynamic returnUrl. |
You could just redirect the user after reaching the return URL. |
Can confirm this on node v6, running example from this repository fails with this error. On node v4, everything works fine though. |
Anyone found an actual fix for this yet? |
Any fix for this? I've tried everything mentioned above but I'm still getting
|
@Ava-a Does the The issue itself has nothing to do with passport-steam though. Whenever the assertion fails, It's very easy to manually trigger this error too. |
Provably it's not your case but if the error is |
@scholtzm I'm getting this response when I run the
I'm gonna use |
Before I start with the explanation of this issue, here the main facts:
Let us start with the following setup: app.js: var authRoutes = require('./routes/auth.js');
app.use('/auth', authRoutes ); /routes/auth.js: var express = require('express');
var router = express.Router();
router.get('/steam',
passport.authenticate('steam', { failureRedirect: '/' }),
function(req, res) {
res.redirect('/');
});
router.get('/steam/response',
passport.authenticate('steam', { failureRedirect: '/' }),
function(req, res) {
res.redirect('/');
});
module.exports = router; SteamStrategy configuration: new SteamStrategy({
returnURL: 'http://localhost:3000/auth/steam/response',
realm: 'http://localhost:3000/',
apiKey: 'Your API key here'
} Now try to authenticate and you will receive the error "Failed to verify assertion". The error-message "Failed to verify assertion" is just a header for a more specific error. Simply pass a callback to the router.get('/steam/response',
passport.authenticate('steam', function(err){
console.log(err); // Returns the openidError object
});
Once ran, the following error was returned:
As you can see, the return URL appeard to be invalid. node-openid/openid.js if (originalReturnUrl.protocol !== receivedReturnUrl.protocol || // Verify scheme against original return URL
originalReturnUrl.host !== receivedReturnUrl.host || // Verify authority against original return URL
assertionUrl.pathname !== receivedReturnUrl.pathname) { // Verify path against current request URL
console.log(assertionUrl.pathname); //<-- Wrong URL
console.log(receivedReturnUrl.pathname); //<-- Correct URL
return false;
} => https://github.com/havard/node-openid/blob/master/openid.js#L938 I noticed that the So I went upwards the stack to check what URL is used during the assertion-verification-procedure. passport-openid/strategy.js: this._relyingParty.verifyAssertion(req.url, function(err, result) { => https://github.com/jaredhanson/passport-openid/blob/master/lib/passport-openid/strategy.js#L183 Interesting! As you can see the module passport-openid uses See the statement in the Express API documentation:
=> http://expressjs.com/de/api.html#req.originalUrl Bingo!That is why req.url will not return the full-path, eg. the mount point. In order to keep the mount point we must use You can test this with a simple setup: app.js: var authRoutes = require('./routes/auth.js');
app.use('/auth', authRoutes ); /routes/auth.js: var express = require('express');
var router = express.Router();
router.get('/test', function(req, res, next) {
console.log(req.url)
console.log(req.originalUrl)
next();
});
/* Output:
/test
/auth/test
*/
router.get('/test/response', function(req, res, next) {
console.log(req.url)
console.log(req.originalUrl)
next();
});
/* Output:
/test/response
/auth/test/response
*/ Conclusion:Use Let's do this by adding a simple middleware in front of function use_orginalurl(req, res, next){
req.url = req.originalUrl;
next();
}
router.get('/steam/response', use_orginalurl,
passport.authenticate('steam', { failureRedirect: '/' }),
function(req, res){
res.redirect('/');
});
//or simpler:
router.get('/steam/response',
function(req, res, next){
req.url = req.originalUrl; next();
}, passport.authenticate('steam', { failureRedirect: '/' }),
function(req, res){
res.redirect('/');
}); |
@Burnett01 Beautifully explained. I haven't been having this issue, but that should certainly clear everything up for those who are having the issue. |
@Burnett01 thanks a lot I had the exact same issue, nice workaround. This should be added to the example ! https://github.com/liamcurry/passport-steam/blob/master/examples/signon/app.js |
@Burnett01 Thanks so much for your help! I've taken @beuted's suggestion and created a separate example that demonstrates the workaround you've listed. I've added you to the contributors list for your debugging work! Thanks! |
@Burnett01 thanks for this! I stuck with this issue as well. The only question is, why did it happen only from time to time, if it is some kind of persistent misconfiguration? |
As per my older comment here, you can easily trigger this manually by providing invalid OpenID data. The data also expires, so some users might trigger this accidentally even if they don't tinker with the data at all, just by going AFK while logging in. |
For me this error was fired, when you get incorrect response from Steam itself. It happens mostly when you have sent too many requests recently, so SteamAPI returns you "Access denied..." page. |
I got an alert for this so I guess I'll post what it ended up being for me. My VPS provider switched me to a new box an in the process it killed my time. The ntp configuration was broken because they block most ip's and for some reason my ntp server config was lost. I spent a good few days trying to figure out the problem and it ended up being the wrong time on my VPS. |
@scholtzm Why don't this use the |
It's not throwing, the |
@scholtzm Could you write a quick example on how to catch that error ? I can't figure it out myself sadly. |
Personally, I don't use However, the error should be passed all the way to your express error handler: https://expressjs.com/en/guide/error-handling.html Another options seems to be to pass callback to passport.authenticate('steam', { failureRedirect: '/login' }, (err, ...otherArgs) => {
// do something with err
}); |
So I tried @scholtzm example to catch errors, but this is just the passport callback, if you use it, it will bypass passport-steam. app.get('/auth/return',
passport.authenticate('steam', {failureRedirect: '/'}),
(err, req, res, next) => {
if (err) console.error(err);
next();
}, (req, res) => {
res.redirect('/');
}); |
I'm having issues with when an existence user trying to login back, non existence user login works alright, tried @Burnett01 solution but doesnt work tho, still get the error. How can I solve this, Can someone kindly help?
/routes/auth.js
app.js
|
Hope this help someone List of errors returning "Failed to verify assertion": Take a look to the five minutes limit and set the correct time on the server |
This issue has now resurfaced: #129 |
Hello,
I've been running in this issue all day, and I still don't know totally how to fix it.
I've got this error with this module, both on node 4.4 and node 6.0
So naturally I digged in the source code, and changed this line:
to:
This resolved the issue on node 4.4, but got an error on node 6.0 (that's why that modules is created i guess):
Anyone has fixed that first issue? There where some discussions with the same issue, but nothing fixed that for me (relevant: #27 ). These are part of my code:
The text was updated successfully, but these errors were encountered: