This application is using Cesium's default ion access token. How can i fix this warning?

I, everyone!
I create a world map using this code:
Cesium.BingMapsApi.defaultKey = 'MY KEY';
var viewer = new Cesium.Viewer('cont', {
        selectionIndicator: false,
        navigationHelpButton: false,
        navigationInstructionsInitiallyVisible: false,
        baseLayerPicker: false,
        geocoder : [
            new Cesium.CartographicGeocoderService(),
            new Cesium.BingMapsGeocoderService()
        ],
        terrainProvider: Cesium.createWorldTerrain(
        {
            requestWaterMask: true,
            requestVertexNormals: true
        })
});
var imageryProv = new Cesium.BingMapsImageryProvider({
        url: '//dev.virtualearth.net',
        mapStyle: Cesium.BingMapsStyle.AERIAL
    });
var imageryLayers = viewer.imageryLayers;
imageryLayers.addImageryProvider(imageryProv);
I have warning: "This application is using Cesium's default ion access token. Please assign Cesium.Ion.defaultAccessToken with an access token from your ion account before making any Cesium API calls".

I don't want to use Ion in my project. In documentation i saw that BingMapsImageryProvider by default is provided through Cesium ion. To go back to the old default behavior with BingMaps my code should be like:
var viewer = new Cesium.Viewer('cesiumContainer', {
    imageryProvider : new Cesium.BingMapsImageryProvider({
        url : 'https://dev.virtualearth.net'
    }),
    geocoder : [
            new Cesium.CartographicGeocoderService(),
            new Cesium.BingMapsGeocoderService()
    ]
});
I've done all like in example, but warning is still there. Also i change geocoder to false. Nothing changed too.

What can be wrong with my code?
Thank you for any help.

I think you’re missing a key to the BingMapsImageryProvider constructor. See:

https://cesiumjs.org/Cesium/Build/Documentation/BingMapsImageryProvider.html

Hope this helps!

thanks for advice, but the warning still exists

You’re right, I just tried it out. Looks like that warning will be there as long as as Cesium.Ion.defaultAccessToken is set, because even if you’re not loading imagery from ion on startup, you could still load assets and it’ll use the default access token.

So all you have to do is set it to null or something else and that should remove the warning. The example below works for me.

Cesium.Ion.defaultAccessToken = null;

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

imageryProvider: new Cesium.BingMapsImageryProvider({

url : ‘https://dev.virtualearth.net’,

key: ‘’,

mapStyle: Cesium.BingMapsStyle.AERIAL_WITH_LABELS

}),

baseLayerPicker : false

});

``

thanks again!
As Ion defaultAccessToken tried null and valid ion token, but, unfortunately, with your example i still have the warning.
I know that ion is by default in geocoder, imageryProvider and terrainProvider in cesiumjs 1.48, but in github i saw that the last version also should work with previos cesium's default bingmaps key.

did you have any errors in developer mode in browser?

It looks the docs are actually outdated. It says here that it will use a default Bing key:

https://cesiumjs.org/Cesium/Build/Documentation/BingMapsImageryProvider.html

But this is no longer true. You’ll have to get a key from https://www.bingmapsportal.com/ if you’re not using Cesium ion.

I just tested with a geocoder, and this code works once I add my key in (and doesn’t show the ion warning).

Cesium.Ion.defaultAccessToken = null;

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

imageryProvider: new Cesium.BingMapsImageryProvider({

url : ‘https://dev.virtualearth.net’,

key: ‘’,

mapStyle: Cesium.BingMapsStyle.AERIAL_WITH_LABELS

}),

baseLayerPicker : false,

geocoder : [

new Cesium.CartographicGeocoderService(),

new Cesium.BingMapsGeocoderService({key:’’})

]

});

Thanks for pointing out the confusion here. I’ll update the docs.

No errors with my latest example. Are you getting an error? Can you post it here?

I experimented with your code, error was with accessing to cesium. I think my code has wrong lines, so this error appears.

Your latest example with code fixed my warning, many thanks!!

But when i added terrainProvider error appeared again))
my code looks like:

Cesium.Ion.defaultAccessToken = null;

    var viewer = new Cesium.Viewer('cesiumContainer', {
        imageryProvider: new Cesium.BingMapsImageryProvider({
                    url : 'https://dev.virtualearth.net',
                    key: '<KEY>',
                    mapStyle: Cesium.BingMapsStyle.AERIAL
                }),
        baseLayerPicker : false,
        geocoder : [
            new Cesium.CartographicGeocoderService(),
            new Cesium.BingMapsGeocoderService({key:'<KEY>'})
                ],
        terrainProvider: Cesium.createWorldTerrain({
            requestWaterMask: true,
            requestVertexNormals: true
                })
    });

If I use terrainProvider i can only use IonImageryProvider and IonGeocoderService instead of geocoder and imageryProvider (with BingMap key)? How should code looks like (to avoid warning with token access)? Thanks.

I fixed warning. My problem was in invalid ion access token (don't know why it was invalid, i checked it many times). I replace program with new ion token and my code works. Omar, many thanks for your help.