Closed ale-cristofori closed 5 years ago
Just do it in entry point such as index.js:
import Cesium from "cesium";
Cesium.Ion.defaultAccessToken = "YOUR_ACCESS_TOKEN";
ReactDOM.render(
// ...
)
import Cesium from "cesium"; Cesium.Ion.defaultAccessToken = "YOUR_ACCESS_TOKEN";
Import of Cesium
was returned as undefined
.
Rather, do this
import { Ion } from "cesium";
Ion.defaultAccessToken = "YOUR_ACCESS_TOKEN";
Hello, I did Ion.defaultAccessToken = "YOUR_ACCESS_TOKEN";
but I still have the "This application is using Cesium's default ion access token. Please assign Cesium.Ion.defaultAccessToken..."
Did something change ?
It's kind of weird because I can display my own asset from cesium ion, which I can't if I remove this line and run with the default AccessToken. So it's working, but not completely ?
Facing the same issue as @badoubadou
Hi, I have the same problem.
Hello, I did
Ion.defaultAccessToken = "YOUR_ACCESS_TOKEN";
but I still have the "This application is using Cesium's default ion access token. Please assign Cesium.Ion.defaultAccessToken..." Did something change ? It's kind of weird because I can display my own asset from cesium ion, which I can't if I remove this line and run with the default AccessToken. So it's working, but not completely ?
I solved this problem by encapsulating the token into the defaultAccessToken attribute. By the way,I didn't use the original cesium , I use the Resium which integrates Cesium with React, I think you could consider bingding this property to a jsx element.My complete code is as follows:
import { Ion } from "cesium";
Ion.defaultAccessToken = "YOUR_TOKEN";
const Map = () => {
return (<Viewer defaultAccessToken = {Ion}> <Viewer/>);
}
export default Map;
Unfortunately the below is not a thing or Viewer removed that attribute at some point. The cesium docs have the above methods Cesium.Ion.defaultAccessToken
or Ion.defaultAccessToken
depending on how you've included the cesium source.
import { Ion } from "cesium"; Ion.defaultAccessToken = "YOUR_TOKEN"; const Map = () => { return (<Viewer defaultAccessToken = {Ion}> <Viewer/>); } export default Map;
Unfortunately the below is not a thing or Viewer removed that attribute at some point. The cesium docs have the above methods
Cesium.Ion.defaultAccessToken
orIon.defaultAccessToken
depending on how you've included the cesium source.import { Ion } from "cesium"; Ion.defaultAccessToken = "YOUR_TOKEN"; const Map = () => { return (<Viewer defaultAccessToken = {Ion}> <Viewer/>); } export default Map;
yeah, you are right, I checked the source code of "Viewer" component, the "defaultAccessToken " attribute does not exist
When using the Viewer component in Resium there is a message on the the bottom saying "This application is using Cesium's default ion access token. Please assign Cesium.Ion.defaultAccessToken..."
I was wondering if it would be possible to insert my own Cesium token.