frontend: attach auth credentials to all API requests
Add Authorization Bearer header to all fetch calls (apps, stream start). Handle 401 responses by clearing token and redirecting to login. Pass stream_token from the stream start response through to the WebTransport URL as a query parameter for proxy authentication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,17 +8,20 @@
|
||||
certHash: Array<number>;
|
||||
width: number;
|
||||
height: number;
|
||||
streamToken: string;
|
||||
}
|
||||
|
||||
let { url, certHash, width, height }: Props = $props();
|
||||
let { url, certHash, width, height, streamToken }: Props = $props();
|
||||
let loading = $state(true);
|
||||
let fullscreen = $state(false);
|
||||
let gameplayView: HTMLDivElement;
|
||||
let gameplayCanvas: HTMLCanvasElement;
|
||||
|
||||
async function startStream() {
|
||||
// Append stream token to URL for proxy authentication
|
||||
const authenticatedUrl = url + (url.includes('?') ? '&' : '?') + 'token=' + encodeURIComponent(streamToken);
|
||||
await startWebtransportStream(
|
||||
url,
|
||||
authenticatedUrl,
|
||||
certHash,
|
||||
width,
|
||||
height,
|
||||
|
||||
Reference in New Issue
Block a user