This issue occurs when the Moodle version is less than of 3.5.11, 3.6.9, 3.7.5 or 3.8.2. This issue started happening with Chrome 80, and is fixed by Moodle.
For more details: https://tracker.moodle.org/browse/MDL-67175
Symptom:
When clicking "insert" inside the popup, the iframe is redirected to the Moodle login page.
Solution:
To fix this, the Moodle version needs to be updated to at least 3.5.11, 3.6.9, 3.7.5, 3.8.2, or future ones.