Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I'm trying to set up the Javascript SDK using proxy auth from a Rails server. Following the instructions at https://github.com/looker-open-source/sdk-codegen/tree/main/packages/sdk#using-a-proxy-for-authentication I've written a class that extends ProxySession but it's throwing an error trying to set the token:

Uncaught (in promise) Error: Cannot read properties of undefined (reading 'setToken')
    at sdkError (transport.js:171)
    at transport.js:200
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (transport.js:1)
    at _next (transport.js:3)

Code:

import { ProxySession, ApiSettings, BrowserTransport } from "@looker/sdk-rtl";

class EmbedSession extends ProxySession {
  constructor(settings, transport) {
    super(settings, transport);
  }

  async authenticate(props) {
    const token = await getAuthToken();

    if (token) {
      this.activeToken.setToken(token); // <- error
    }
    // rest of this method is copy-pasted from the example, I don't even know if it works yet
  }
}

Stepping through the code it looks like this.activeToken object is undefined, and I'm not sure why. Other than this EmbedSession I haven't really touched the ApiSettings and BrowserTransport passed to initialise the SDK (using const LookerSDK = LookerBrowserSDK.init31(settings, transport, session);). Does one of those set up activeToken?

The actual token should be fine, it's coming from a LookerSDK::Client instance in the Rails backend, using method #access_token. That SDK auths and hits Looker just fine, with surprisingly little setup.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.