0

I'm not sure if this is a security feature or if I'm missing something obvious. I need to access one of my ExpressJS routes directly via a standard link on the page.

If I type the URL in to my browser location bar, I get the desired result. However, if I put that exact URL in a standard link on one of the pages on the site, the route never gets hit.

EDIT: Even if I pull this out of the router and add directly to app.js I get the same results. I'm simply trying to use Passport's Facebook authentication. The first route looks like this:

router.get('/login/facebook', function(req, res, next) {
     passport.authenticate('facebook')(req, res, next);
});

I realize the req function wrapper is not needed, I was using it for debugging so I could see when the route gets called.

If I set a breakpoint there, it works fine if I just type the "/api/login/facebook" URL into my browser, but if I put the exact URL in a link on the page, the route never gets hit.

amnesia
  • 1,956
  • 2
  • 18
  • 36

1 Answers1

0

It turns out this was caused by Angular's routing mechanism intercepting the links. I found the solution here:

How to get Angular UI Router to respect "non-routed" URLs

Community
  • 1
  • 1
amnesia
  • 1,956
  • 2
  • 18
  • 36