diff --git a/components/simple-transcription/index.js b/components/simple-transcription/index.js index 769dd9fd..d6138436 100644 --- a/components/simple-transcription/index.js +++ b/components/simple-transcription/index.js @@ -872,7 +872,20 @@ export default class SimpleTranscriptionInterface extends HTMLElement { const projectPage = TPEN.activeProject?.layers ?.flatMap(layer => layer.pages || []) .find(p => p.id.split('/').pop() === currentPageId) - + + // Forward auth to TPEN-Prompts only; other tools do not receive the token. + if (tool.toolName === 'tpen-prompts') { + iframe.contentWindow?.postMessage( + { + type: "AUTH_TOKEN", + token: this.userToken ?? null, + projectID: TPEN.screen?.projectInQuery ?? null, + pageID: currentPageId ?? null + }, + this._iframeOrigin + ) + } + iframe.contentWindow?.postMessage( { type: "MANIFEST_CANVAS_ANNOTATIONPAGE_ANNOTATION", diff --git a/interfaces/transcription/index.js b/interfaces/transcription/index.js index d9b9609b..74cbb702 100644 --- a/interfaces/transcription/index.js +++ b/interfaces/transcription/index.js @@ -402,6 +402,19 @@ export default class TranscriptionInterface extends HTMLElement { this._iframeOrigin = new URL(tool.url).origin iframe.addEventListener('load', () => { + // Forward auth to TPEN-Prompts only; other tools do not receive the token. + if (tool.toolName === 'tpen-prompts') { + iframe.contentWindow?.postMessage( + { + type: "AUTH_TOKEN", + token: this.userToken ?? null, + projectID: TPEN.screen?.projectInQuery ?? null, + pageID: TPEN.screen?.pageInQuery ?? null + }, + this._iframeOrigin + ) + } + iframe.contentWindow?.postMessage( { type: "MANIFEST_CANVAS_ANNOTATIONPAGE_ANNOTATION",