Hello,
In summary, we need a way to deactivate a preflight script set in the studio when the Apollo Explorer is used in embedded form in an Angular app (@apollo/explorer/src/EmbeddedExplorer). This script is responsible for getting the SSO authorisation token that will be passed to the request as a header. The script is not needed/causing issues when the explorer is used embedded.*
More details:
For one of our Angular apps, we need to use the embedded version of the explorer - the app has its own SSO login system to get the token, which we just pass to the embedded explorer using a handleRequest header. This makes the preflight script redundant in this scenario & also a blocker due to some errors it causes/dialogs it opens.
I’ve been looking into ways to automatically disable the preflight script when it’s being used as embedded. Here are the approaches that didn’t work:
-
setting an env variable and then checking its value inside the script - did not manage to set an env variable from the embedded explorer, I think it’s only possible to do it directly from the studio
-
sending a custom header from the embedded explorer, but this also doesn’t work as the preflight script doesn’t seem to interact with the requests like that (at least I didn’t manage to make this work, I get undefined on what I tried)
-
checking with window.top/window.parent, this doesn’t work as the script is not running inside the browser
Is there anything else I can try? Thanks!