Reputation: 441
I'm building a web app with MEANjs and I'm having some trouble with the Oauth callbacks for Facebook, Twitter, and Google+ (lnkedin works fine). Basically everything works, but the callback gives me 'Page Not Found' Error: /api/auth/facebook/[object%20Object] is not a valid path.
If i navigate to another page, I find that I am logged in. The routes seem to be correct, as generated by MEANjs
app.route('/api/auth/facebook').get(users.oauthCall('facebook', {
scope: ['email']
}));
app.route('/api/auth/facebook/callback').get(users.oauthCallback('facebook'));
I've checked the callbacks in the facebook app setup and they're fine. Totally stumped. Would love any help or advice.
Thanks.
Upvotes: 2
Views: 411
Reputation: 441
The comments by @user3632710 led me to the issue that was indeed a URL concatenation issue ass @Paul suggested. The offending code is at line 121 of modules/users/server/controllers/users/users.authentication.server.controller.js
which is: return res.redirect(redirectURL || sessionRedirectURL || '/');
for now i've just commented this out and redirected to the root, which is fine for my purposes but inelegant generally:
return res.redirect('/');
Thanks for all your help, hope this helps someone else.
Upvotes: 4
Reputation: 36339
Whatever code is building your URL is clearly not doing it right. It looks like you're calling toString() (directly or indirectly) on an object, and that's being concatenated with the URL in question, which your server-side routes don't know how to handle. The code you've posted is incomplete for helping us find the error for you, but I'd look in whatever logic is building that URL.
Upvotes: 0