You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
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:
Code:
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 (usingconst LookerSDK = LookerBrowserSDK.init31(settings, transport, session);
). Does one of those set upactiveToken
?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.Beta Was this translation helpful? Give feedback.
All reactions