I've seen many JavaScript fixes for this using window.location
, but nothing for Node.js.
I'm using OAuth to connect users to Facebook. Upon authorization, Facebook redirects to your callback URL and appends "#=" to it. The problem is in my callback route I redirect to another URL, but the URL fragment (hash) is being carried over.
This is my route for Facebook's callback:
exports.facebook_signin_complete = function(req, res)
{
res.redirect('/profile');
};
If I remove the redirect the URL is /auth/facebook/callback#_=_
, and if I keep the redirect the URL is /profile#_=_
. Why is the hash being carried over? That's a page specific anchor marker, so I'd be very surprised if that's what it's supposed to do.
The hash in a URL is client-side only, so you can't modify it from the server side of things. When I ran into the same problem I ended up just adding window.location.hash = '';
to the top of my initial JS file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With