Getwithpopup is sometimes not closing automatically

Hi ,
I am using token.getWithPopup() function to fetch new tokens when tokens are expired, after entering credentials ,

  • At one instance, it is displaying a window with okta login page. Post successful validation it is getting closed, and the application is resumed in the background.
  • At another instance, the same window with okta login page is opened and post successful validation it is logging into our application directly rather than closing. it is like the application is running in the popup window, instead of closing automatically. can you please tell us how this could happen.
    I passed params in getwithpopup({ prompt : ‘login’});

Basically I am trying to implement silent token renewal in my angular application, is there any other way to renew the tokens without redirecting if the cookies are blocked.?