Invalid access token when not using Ion

Hi all,

My app shows a warning (401 Unauthorized) before loading any imagery. It uses its own terrain model and imagery (hosted in our servers).

The URL unauthorized is this one:

https://api.cesium.com/v1/assets/2/endpoint?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0NDViM2NkNi0xYTE2LTRlZTUtODBlNy05M2Q4ODg4M2NmMTQiLCJpZCI6MjU5LCJpYXQiOjE1MTgxOTc4MDh9.sld5jPORDf_lWavMEsugh6vHPnjR6j3qd1aBkQTswNM

``

And the “Preview” tab content (Chrome) is:

{code: “InvalidCredentials”, message: “Invalid access token”}

``

So the app don’t use any Ion resource. Does anyone know the reason for this warning?

Cesium version: 1.48

Thanks in advance

Hi Juan,

I had the same issue and I emailed them about it and this is what they said:

“Are you streaming
terrain into your app from assets.agi.com?
That service was turned off on Oct 1st so maybe that is causing the issue?
We’ve made several announcements over that last 9 months that it would be
deprecated 9/1/18 but then we extended it to 10/1/18.”

If you update to version 1.50, you’ll be able to use their new ion service without changing anything on your side (access tokens, code, etc.). The new service is free for personal use, but not for commercial use.

If you’re not using anything from ion, then you have to set the default ion token to undefined, as well as turn off the base layer, see this thread:

https://groups.google.com/d/msg/cesium-dev/OPYLmP4iCe8/Uy788PJqDwAJ

Let me know if that works.

Hi again,

I set Cesium.Ion.defaultAccessToken to undefined, but the result is the same: 401 (Unauthorized)

with the error:

{"code":"InvalidCredentials","message":"No authorization token was found"}

By the moment, the app goes well, only shows that message in the console.

Regards

Juan,

By default, Cesium connects to ion for both Bing Maps imagery and geocoding. The url you posted indicates Bing imagery (ion asset 2) is active. If you do not wish to use either of these and want to disable everything ion related, you need to pass options to the viewer widget:

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

geocoder: false,

imageryProvider: false,

baseLayerPicker: false

});

Instead of false you can pass your own geocoder, imageryProvider or a custom selection of base layers for the picker; it depends on whether you are using these things in your application.

Hope that helps,

Matt

Matt,

Yes, I create the viewer the way you say, setting geocoder and baseLayerPicker to false, and creating imageryProvider from our WMS servers.

The error disappeared when I updated Cesium from 1.48 to 1.50.

Thanks to all.