Useless API call CesiumJS

Hello,

I’m using CESIUM JS (1.124.0) in my Angular 19 project.
When I start my application, I get an API call:

Response: https://api.cesium.com/v1/assets/2/endpoint?access_token: {“code”: “INVALID_TOKEN”, “message”: “Invalid access token”}

I’m using Cesium without ION, so I don’t understand the purpose of this message. Here’s how I integrate Cesium. Do I need to add an option? Thanks in advance for your help!

    this.mapViewerService.initializeViewer('cesiumContainer', {
      terrainProvider: new Cesium.EllipsoidTerrainProvider(),
      timeline: this.isShowingMapTimeLine,
      animation: this.isShowingAnimation,
      geocoder: false,

      // Disable useless button
      baseLayerPicker: false,
      homeButton: false,
      sceneModePicker: false,
      navigationHelpButton: false
    });

  /**
   * Initialize the Cesium Viewer
   * @param containerId The ID of the DOM container for the Cesium viewer
   * @param options Optional Cesium Viewer options
   */
  initializeViewer(containerId: string, options?: Cesium.Viewer.ConstructorOptions) {
    if (this.viewer) {
      console.warn('Cesium Viewer is already initialized.');
    } else {
      this.viewer = new Cesium.Viewer(containerId, options);

      console.log('Cesium Viewer initialized.');
      this.viewerInitializedSubject.next(true);
      // Remove cesium ion logo
      this.viewer.cesiumWidget.creditContainer?.parentNode?.removeChild(this.viewer.cesiumWidget.creditContainer);

      // Add imagery
      this.viewer.imageryLayers.addImageryProvider(new Cesium.UrlTemplateImageryProvider({ url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png' }))

      // Set camera view (show france)
      this.viewer.camera.setView({
        destination: Cesium.Rectangle.fromDegrees(-10, 35, 20, 52),
        orientation: {
          heading: Cesium.Math.toRadians(0.0)
        }
      });
    }
  }

When the viewer is created and no baseLayer was specified, then it will create a default base layer, and (“immediately”) start sending out requests for that.

You can set the imagery layer (that you added later manually) directly as the baseLayer in the options:

Thanks for your reply!
I did this
baseLayer:

Cesium.ImageryLayer.fromProviderAsync(Promise.resolve(
new Cesium.UrlTemplateImageryProvider({
url: "https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
}))),

and it seems to work. However, if I comment out the part to remove the icon, it’s still there.

viewer.cesiumWidget.creditContainer?.parentNode?.removeChild(this.viewer.cesiumWidget.creditContainer

Does this mean there’s still a link to Cesium ION?

Not necessarily. Removing the icon (like that) is not a “built-in” functionality. You originally posted code that seemed to be embedded in some other context than a sandcastle. If you want to remove the icon, then you have to adjust that for your actual component structure.

Ok thanks for your help :smiley: