We can get it working by adding token to the headers with this:
And it works for say feature services. But it does not work well with basemap: the first call to basemap is successful, but when the tiles are fetched, we get a 401 authentication failure.
Here is the exact same error with some visuals:
Has anyone got it working with getting basemap tile requests to work with custom header?