I’m trying to write a Meteor program that opens a new window, then once our user logs into this new window I want to close it, and render a new template on the first window.
How can I do this? I currently open a new window with…
Template.launch.events({
'click #logIn': function(event){
event.preventDefault();
var loginURL = baseURL+'oauth2/authorize?response_type=code&client_id='+ client_id +'&redirect_uri='+redirect_uri;
window.open(loginURL, '_blank');
}
});
And I handle the redirect with Iron Router using:
Router.route('_oauth/', function(){
var params = this.params;
var code = params.query;
Meteor.call('passCode', code.code);
this.render('auth');
});
How can I close this window that I open, and then return focus to the fist window for it to render the “auth” template?