popup is now a constructor function instead of an object
use angular $interval to poll for code or token and then clear it once token/code is obtained