I am currently developing a Chrome App that requires user authorization. For example, if a user wants to share a tweet on a website and clicks on a button, the app will first look for the user's access token in the Chrome storage. If the access token is not available, I will open a new window using the code snippet below:
window.open(url);
The "url" referred to in the code above is an authorization API provided by the specific website. The user will then input their login information (username/password) and be redirected to a callback concatenated with a unique code necessary for the access token.
To avoid the user being redirected and to capture that code required, I am trying to figure out how to intercept the redirection, retrieve the code, and close the window once the user has completed the authorization process.