How to implement on-the-fly authentication ?

Hi all,

  • I’m creating a SPA with Angular 4
  • My use case: pretty simple. I have button that brings the user to a page (via routerLink). The user must be authenticated to access the page. Flow must be as follow: (1) If the user is already authenticated when he clicks on the button, the protected page must be displayed. (2) If not authenticated when clicking on the button, the login prompt must be displayed, and after successful authentication, the protected page must be displayed.
  • my route is dynamic (e.g.: /register/234) → I cannot have a fixed callback URL