0

How to prevent user from opening admin.html in browser if the user is not logged in or if the user is not an admin in node.js + angular? I'm trying to use redirect and checking session but it give me nothing. I still can open admin.html page from browser. enter image description here

  • Maybe one ot these can help you: https://stackoverflow.com/questions/15905547/angularjs-prevent-not-authenticated-user-from-accessing-given-routes https://coderwall.com/p/f6brkg/angularjs-access-control-and-authentication – Hannes Jan 09 '18 at 15:28
  • 1
    If you're serving `admin.html` from a static folder, it will be always accessible to anyone by the Webserver itself – fingeron Jan 09 '18 at 15:29
  • I created a project on Node.js+Angular I have routes in this project. How I can create redirect to '/' if the user prints whatever link in searching panel. – Viktor Gnativ Jan 10 '18 at 10:46

1 Answers1

0

Route Guards can be implemented for authentication purposes Ways to redirect in case a non authenticated user tries to access a special route

for more in depth go to angular site

Iancovici
  • 5,574
  • 7
  • 39
  • 57
  • I created a project on Node.js+Angular I have routes in this project. How I can create redirect to '/' if the user prints whatever link in searching panel. – Viktor Gnativ Jan 10 '18 at 10:47