mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
feat: load Google 3D with short-lived server tokens
Without a browser key, the app asks its server for a short-lived Google access token (GET /api/google/tiles-token, answering accessToken and expiresAt) and loads Photorealistic 3D Tiles directly with it as a header. A tile refused for an expired token gets a renewed one and is retried once. A server that does not offer tokens changes nothing: the app continues through ion or the keyless globe as before.
This commit is contained in:
1 parent
e1bd2f7bf1
commit
a2f61d4def
6 files changed
+266
-12
No files matched your search
@@ -6,6 +6,7 @@ import { createStandaloneScene } from './scene.js';
|
||||
import { createStandaloneControls } from './controls.js';
|
||||
import { createStandaloneData } from './data.js';
|
||||
import { createStandaloneTools } from './tools.js';
|
||||
import { createGoogleTokenSource } from '../maps/googleTokens.js';
|
||||
|
||||
// The existing controls and layer catalog contain page-scoped state.
|
||||
let constructed = false;
|
||||
@@ -39,6 +40,9 @@ export function createStandaloneApplication({
|
||||
const scene = await createStandaloneScene({
|
||||
...context,
|
||||
googleApiKey,
|
||||
// Without a key, Google 3D can still load with tokens from the
|
||||
// app's server when it offers them.
|
||||
googleTokens: googleApiKey ? null : createGoogleTokenSource(),
|
||||
cesiumToken,
|
||||
loaderStatus,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user