From 88703372176396d02f0761a08eb03cfb4059139f Mon Sep 17 00:00:00 2001 From: Daniel Lopes Date: Fri, 18 Aug 2023 12:13:30 +0200 Subject: [PATCH] feat: support signed embed urls during backend session creation --- src/embed.ts | 4 ++++ src/types.ts | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/src/embed.ts b/src/embed.ts index 9b9e235..e742e93 100644 --- a/src/embed.ts +++ b/src/embed.ts @@ -290,6 +290,7 @@ export class EmbedClient { navigation_token, navigation_token_ttl, session_reference_token_ttl, + signed_embed_url, } = await this.acquireSession() if (!authentication_token || !navigation_token || !api_token) { throw new Error('failed to prepare cookieless embed session') @@ -299,6 +300,9 @@ export class EmbedClient { this._cookielessNavigationToken = navigation_token this._cookielessNavigationTokenTtl = navigation_token_ttl this._cookielessSessionReferenceTokenTtl = session_reference_token_ttl + if (signed_embed_url) { + return signed_embed_url + } const apiHost = `https://${this._builder.apiHost}` const sep = new URL(this._builder.embedUrl, apiHost).search === '' ? '?' : '&' diff --git a/src/types.ts b/src/types.ts index 369816f..6595bef 100644 --- a/src/types.ts +++ b/src/types.ts @@ -86,6 +86,13 @@ export interface LookerEmbedCookielessSessionData { * Session time to live in seconds. */ session_reference_token_ttl?: number | null + + /** + * Backend generated embed url for sessions with access to an exclusive component. + * For when using callback methods that inject additional information for session creation. + * If present, this value bypasses local url generation. + */ + signed_embed_url?: string | null } /**