One of our industrious clients discovered this and I wanted to share it more broadly just in case anyone else was trying to do something similar. When using Google Apps Script endpoints for AMIs, they worked well out of the box. However when enabling the modal functionality on the AMI, they began getting
script.google.com refused to connect errors.
This was because by default Google will block embedding in other web pages. You can fix this by using the
setXFrameOptionsMode(mode). Read more about that here: