Thursday 16 March 2017

angular2 open instagram authentication window

I'm using Angular2 / Nodejs. I have a button for login via instagram and have a event to click on it.

  loginWithInstagram() {
    //the pop-up window size, change if you want
    var popupWidth = 700,
      popupHeight = 500,
      popupLeft = (window.screen.width - popupWidth) / 2,
      popupTop = (window.screen.height - popupHeight) / 2;
    //the url needs to point to instagram_auth.php
    var popup = this.nativeWindow.open('http://localhost:3000/instagram/api/v1/users/loginInstagram', 'Login via Instagram', 'width='+popupWidth+',height='+popupHeight+',left='+popupLeft+',top='+popupTop+'');





   // window.open('https://instagram.com/oauth/authorize/?client_id=f25859b1f5724a96a800216400ee8b92&redirect_uri=http://localhost:3000/instagram/api/v1/users/login'+'&response_type=token', 'ConnectWithOAuth', 'location=0,status=0,width=800,height=400');
  }

Now, I would like to close window, when I get from server response "ok". How can I do this?



via Vahe Akhsakhalyan

No comments:

Post a Comment