How to create an OAuth Popup in React

In this article I’ll explain how to to launch a popup on an external URL (e.g. Oauth login), detect when that popup redirects to a different location (Oauth callback) and access the popup URL param values (e.g. code=xyz ) in order to send it to the backend API.


React doesn’t natively allow to create and control popups, but both creation and checking of the popup can be done with native javascript , by keep the reference in a status variable, and a (launched on component mount) to check the status of…