如何在Openlayers VectorTile-ol.layer.VectorTile的头中添加身份验证令牌

如何在Openlayers VectorTile-ol.layer.VectorTile的头中添加身份验证令牌,openlayers,Openlayers,我正在寻找帮助,将身份验证令牌作为头参数添加到下面的代码中,例如Bearer-accesstoken。以下链接提供了ImageTile的示例 new ol.layer.VectorTile({ source: new ol.source.VectorTile({ format: new ol.format.MVT(), url: "tile_url",

我正在寻找帮助,将身份验证令牌作为头参数添加到下面的代码中,例如Bearer-accesstoken。以下链接提供了ImageTile的示例

new ol.layer.VectorTile({
                    source: new ol.source.VectorTile({
                        format: new ol.format.MVT(),
                        url: "tile_url",

                    }),
                    style: function(feature, res) {
                        return new ol.style.Style({
                            stroke: new ol.style.Stroke({
                                width: 1,
                                color: 'rgba(0, 102, 204)'
                            })
                        })
                    }
                })

您应该创建一个函数以提供给的tileLoadFunction选项 在这个函数中,您需要自己发出ajax请求并添加所需的身份验证令牌

虽然这里是针对矢量图块的,但它的原理与