ronzeidman / ng2-ui-auth-example

MIT License
34 stars 14 forks source link

OAuth popup window redirects to base url #9

Closed godlovesugly closed 7 years ago

godlovesugly commented 7 years ago

Hi,

Just started using this and there's an irritating issue with the OAuth popup window.

Most of the times I get redirected to the base url of my site in the popup window as soon as it opens and the first request is made (in case of Facebook), and after selecting the account (in case of Google). If I then close the popup, I get an error saying "Authentication canceled".

Do you have any suggestions in how to fix this?

Thanks.

ronzeidman commented 7 years ago

You should catch the "Authentication Cancelled" and handle or ignore it (it's "by design"). It's a good thing to handle exceptions whenever they throw.

As for the redirection, you can specify in the provider redirectUri: 'https://my-domain.com/anything' just remember to approve it in your provider's site (google/facebook console).

godlovesugly commented 7 years ago

Thanks. The problem is that the redirection happens inside the pop-up and it is not being closed. The redirectUri is being loaded inside the pop-up.

ronzeidman commented 7 years ago

Your redirectUri must be under the same host as your login page. So if your login page is under my-site.com the redirection must also be under my-site.com and not www.my-site.com or anything else.