domfarolino / angular2-login-seed

(deprecated) Seed app w/ Angular2, Node, Express, and OAuth login
https://domfarolino.com/angular2-login-seed
MIT License
181 stars 77 forks source link

Question: Router hack on the client side #23

Closed galvanu closed 7 years ago

galvanu commented 7 years ago

Hi,

Can you please give some details about the hack with this code:

var newWindow = window.open

and in what version of router this issue is solved?

domfarolino commented 7 years ago

Well the idea is that we open a new window for the authentication to happen given whatever third party service you decide to used, and then we'd begin polling for successful (or failed) authentication and the angular app would deal accordingly. Instead of opening this newWindow we could of course just redirect the user to the page where they authenticate themselves and of course have that auth source just redirect back to the app.

It's not a hack to get around the angular router, just something I decided to do to keep the user on the angular app instead of elsewhere I guess.


Question: how experienced are you with Angualr2? I'm looking to let someone have write access to this app to maintain it as I am too busy to maintain it myself.

galvanu commented 7 years ago

Ahh I understand, actually I kind of implemented it in this way in my project - so I open the OAuth authentication url in a new window as you do then I set an event listener in the app window (not the new one) on specific event. I configured my backend to redirect to '/oauth-success' page when succeeds and then the component fire an event to the opener window (window.opener.dispatchEvent...). When I catch this event in the client side I check if the user exists, closing the new window and navigate to the app.

For your question I have around 1 year experience with angular 2 applications (since the early beta version). I'm not sure I have enough time to maintain this repo but maybe I can contribute in my free time.

domfarolino commented 7 years ago

Nice! Yeah that makes sense. Sounds good, yeah honestly if you ever got around to updating the deps on this and fixing any breaking changes I'd pull you in as a contributor that would be MUCH appreciated. I totally understand the lack of free time though haha

domfarolino commented 7 years ago

Going to close this as it does not really need to be opened.