Jerry Jin - Hello,I am trying to find a way t...

Hello, I am trying to find a way to use our ThoughtSpot's instance's Playground to impersonate other users without writing code, for the purpose of running quick test and troubleshooting. I am the admin and have the secret key therefore I can use trusted auth to obtain access token for other users. Here are the steps I tried: 1. Use the Playground's auth token APIs (Restful V2, full access token or custom token APIs) to obtain a particular user's token. 2. Use any background API such as search Data API, and copy the token from step 1 in the Playground's "Authentication -> Bearer Auth -> Access Token" section to call the API. It retuned correct data meaning this token works. 3. Go to Embed SDK Playground, select to embed a Liveboard. The code has one section about authentication in the "init" block: getAuthToken: getTokenService I modified this line by hard-code the token value: getAuthToken: JSON.stringify({"token":"<the access token string from step 1>"}) when run this, it gets "Not Logged In" error at the embedding area, meaning the auth was not successful. Could you let me know the correct step/syntax to make the above work? Thank you!
1 Reply
Ruchi Anand
Ruchi Anand2w ago
Hi @Jerry Jin The getAuthToken function needs to return a Promise that resolves with the token. Instead of using JSON.stringify, you can just return the token as string directly in a Promise.resolve(). init({ thoughtSpotHost: "host", authType: AuthType.TrustedAuthToken, username: "<username>", getAuthToken: () => { let tsToken = "<your-token>"; return Promise.resolve(tsToken); } }); For more info, refer : https://developers.thoughtspot.com/docs/trusted-auth-sdk
Front-end trusted authentication integration
Front-end trusted authentication integration using Visual Embed SDK

Did you find this page helpful?