Skip to content

Commit

Permalink
feat: support signed embed urls during backend session creation
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-lopes-optimizely committed Aug 18, 2023
1 parent c66936b commit 3e08a5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export class EmbedClient<T> {
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')
Expand All @@ -294,6 +295,9 @@ export class EmbedClient<T> {
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 === '' ? '?' : '&'
Expand Down
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down

0 comments on commit 3e08a5f

Please sign in to comment.