Question

Header token not working with Node Typescript SDK

  • 5 April 2022
  • 0 replies
  • 34 views

I am using the Looker TypeScript SDK version 3.1 to access data from my Looker instance. I am using the Login user method to generate a token, which i store in a Node session. I then provide that token when interacting with the SDK on subsequent calls, ex:

const headerOptions = {
"Authorization": `token ${accessToken}`,
};

const results = await sdk.ok(
sdk.run_inline_query(
{
body: {
[...]
},
[...]
},
{
headers: headerOptions,
timeout: 30,
},
),
);

The SDK call works and I receive data back; however, it does not seem to be respecting the access token that was provided when I initially logged the user in. (Note: the token has not expired.) Instead of receiving data for the specific user, I receive data for another user that is logged into a separate browser (chrome / safari).

 

When I am logged in with “User A” in Chrome, I receive data for “User B” that is logged in with Safari. I can see that I am sending the correct access token for “User A”. Why am I receiving incorrect data and how do I fix it?

 

Note: for my header token, I have tried sending both “token [access_token]” as well as “Bearer [access_token]”.


This topic has been closed for comments