Opened 2 years ago

Closed 21 months ago

Last modified 18 months ago

#2398 closed defect (fixed)

Cesium doesn't show a map with InvalidCredentials (401) error

Reported by: sanak Owned by: osgeolive@…
Priority: critical Milestone: OSGeoLive16.0
Component: OSGeoLive Keywords: cesium
Cc: osgeolive@…

Description

Please see a screenshot.

The error seems to be quite similar with #2323.

Attachments (1)

cesium-invalid-credential-error.png (140.6 KB ) - added by sanak 2 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by sanak, 2 years ago

On my local macOS environment, Cesium-1.94 doesn't work with same error, but the latest Cesium-1.96 works without error, so like #2323, just upgrading Cesium from 1.94 to 1.96 may solve the issue.

comment:2 by darkblueb, 2 years ago

booting RC1 in qemu-kvm ; no cesium globe, only stars background

note: almost every build was checked for cesium demo here; Cesium demo screen worked every time. RC1 is the first build I have seen that does not have Cesium globe demo working.

in reply to:  2 comment:3 by sanak, 2 years ago

Replying to darkblueb:

Okay, thanks for the information.

I guess that Cesium is expiring past versions embedded access tokens.

Current (1.94) embedded access tokens in source files are as follows.

$ cd /var/www/html/cesium
$ grep -zPo -R 'const defaultAccessToken\s*=\n*\s*'[^']+";*\n*' ./
./Build/Cesium/Cesium.js:const defaultAccessToken="eyJh...Ct7c"
./Build/CesiumUnminified/Cesium.js:const defaultAccessToken =
    "eyJh...Ct7c";
./Source/Core/Ion.js:const defaultAccessToken =
  "eyJh...Ct7c":

So, I think the best way is that creating OSGeoLive shared account in Cesium site and getting access token, then set it on the application side.

comment:1:ticket:2323:

In a tutorial it looks like the access_code has to be added before the Cesium Viewer is created: https://cesium.com/docs/tutorials/quick-start/

Add this to /var/www/html/cesium/Apps/HelloWorld.html

    // Your access token can be found at: https://cesium.com/ion/tokens.
    Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwNjJhYTMzNS1lNzZkLTRmNWQtYmY5Zi0wYjdkYjQ2MTE4ZTYiLCJpZCI6NDc1NjUsImlhdCI6MTYxNzEzNTEzOH0.lf_WWRtP9LlyYbVSr0KdhFI4FzReQsqKQwK-vYK5BPI';
    // Initialize the Cesium Viewer in the HTML element with the `cesiumContainer` ID.

comment:4 by kalxas, 2 years ago

Cc: osgeolive@… added
Priority: normalmajor

comment:6 by sanak, 2 years ago

Thanks for creating the PR.

I googled a bit and found that access token expires next release, so it will alive until next release will be published.
https://github.com/CesiumGS/cesium/issues/8433

The default token that ships with the library is only meant for testing and expires with every version release, which is why you'll see this warning at the bottom of the screen when using it in your application:

comment:7 by kalxas, 2 years ago

This is fixed manually in 15.0rc1 VM

comment:8 by sanak, 2 years ago

Thanks! I confirmed it works correctly on the VM.
(On my local desktop environment, setting 3D acceleration off was necessary to see the globe.)

comment:9 by kalxas, 21 months ago

Milestone: OSGeoLive15.0OSGeoLive16.0

Ticket retargeted after milestone closed

comment:10 by kalxas, 21 months ago

This error is back with latest nightly builds.

comment:11 by kalxas, 21 months ago

Priority: majorcritical

comment:12 by kalxas, 21 months ago

Resolution: fixed
Status: newclosed

comment:13 by sanak, 18 months ago

This error happens again in build 40 today.

The latest CesiumJS release seems to be 1.104, so upgrading 1.101 to 1.104 may be necessary. https://github.com/CesiumGS/cesium/releases/tag/1.104

Note: See TracTickets for help on using tickets.