0
votes

What is the best practice in my situation.

I have angular app and express back-end API with passport.js to authorize.

for example, to connect twitter i have GET on "/connect/twitter/" in my express.js back-end. It proceeds with

app.get('/connect/twitter', passport.authorize('twitter-authz'));

in angular app when i click this link request doesn't work - it simply updates browser address bar with this url.

how can I isolate URLs for authentication?

1

1 Answers

1
votes

If you're using $locationProvider.html5Mode(true), Angular will intercept clicks on links to give them this behavior. These are the exceptions to that rule:

  1. Give the link a target attribute. Example: <a href="/ext/link?a=b" target="_self">link</a>
  2. Link to a different domain. Example: <a href="http://angularjs.org/">link</a>
  3. Link to a path starting with '/' that lead to a different base path when base is defined. Example: <a href="/not-my-base/link">link</a>

So, the easiest answer is probably to give the link a target='_self' attribute.

For more details, see "Html link rewriting" at the Using $location guide.