Is it possible to do basic authentication with OpenLayers 3? I found answers that you need to do an ajax-Call and use the token in a "Authentication"-Header.
I wonder if it's possible to tell OpenLayers which header to use because for all my other http-Request I need another Authentication-Header.
Any ideas on this?
I didn't find a better solution than doing the following:
$("<iframe src='https://myWMS.server.com/helloWorld?'/>").on('load', function () {
createMap();
}
If I create the map outside the iframe, I get asked for each tile for a password (because the tiles are loaded asynchronously and don't have the authentication header yet).
So now I send the first request -> get the log-in prompt and the header as a response -> then when I create the map and the tiles are requested they already contain the header.