code refactoring: created a function for adding a postMessage event listener
refactored polling interval into a separate function; return promise when popup is closed
requestAuthorization code function refactoring
pass authorization code directly as a string instead of an object
popup.open() returns a promise after authorization code is received