Situation: I am working on an AngularJS application that utilizes Google's authentication feature.
Depending on the specific resource, when Angular communicates with my backend, it may request an Oauth token. In such cases, Angular will display a popup (not a Bootstrap modal) containing the redirect URL.
Google will authenticate the user, seek permission, and then redirect them back to my application. There is a callback URL that will handle the 'code' and obtain the actual token. This callback URL is triggered within the popup.
Once the token is acquired, the popup should automatically close and inform Angular to retry the last request (now that the token is stored in the user's session)
Issue: How can a popup trigger an event in Angular?
It doesn't necessarily have to be $rootScope.$emit
, but there should be a way to notify Angular.
I came across this solution, but it may not be suitable for Angular :(