How to disable the error of access token when run offline?

Hello,

I work with cesium in offline mode.

So i create the viewer object with:
Geocoder: false,
ImageryProvider: null (because i use typescript it cant be false but only null)
And more…

I got the error:

GET: https://api.cesium.com/v1/assets/2/endpoint?access_token=eyJhbGciOiJIUzI1Ni...I6MjU5LCJpYXQiQjE2MDk3NzQ1OTZ9... Etc.... net:: ERR_NAME_NOT_RESOLVED

Now, i see that its the default ion access token, and i have the error because i work offline.

How to disable it? I dont want to see this error and even dont want send http GET to api.cesium.com when i work offline.

Please help how to solve it!

Thanks in advance.

Hi,
I stumbled on this issue when cesium ion was set up, it seems that if you don’t give any imagery provider to your viewer it defaults to ion, hence the message. I got around this by giving it a very simple imagery provider at viewer creation, that I replace when my assets are loaded.

// create dummy imageryProvider to avoid annoying cesium ion API key message
imageryProvider : new Cesium.TileMapServiceImageryProvider({
	url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')
})
2 Likes

@char thank you for the answer!!! I will try it…

You can alternatively disable the imagery provider like this:

var viewer = new Cesium.Viewer('cesiumContainer',{
    imageryProvider: false,
    baseLayerPicker: false
});

From this article: Understanding and Optimizing Cesium ion Quotas | cesium.com

Note that your app will still use Cesium ion’s geocoder by default. To turn off all cloud features see the “Offline” Sandcastle example: Cesium Sandcastle

1 Like

@omar @char I test it right now and it works!!! Thank you very much!!! :slight_smile:

2 Likes