Vasu Pabbaraju - Hi , I am trying embed Thought...
Hi , I am trying embed ThoughtSpot into a Mobile Device (iOS).
While I am trying to get an auth token I am getting following error
"Failed to load auth token: [Error: Cannot reach ThoughtSpot server. Please check your network connection and ensure the app has been rebuilt.]"
my guess is, something related CORS. Unfotunately I could not find any documentation on Mobile - CORS setting.
Any help on this is greatly appreciated.
11 Replies
Hey @Vasu Pabbaraju ,
Can I know what version of thoughtspot cl you are on.
Also, I would like to check the code snippet for the same. And please do validate the token you will be using.
And yes. please download the latest version through : https://github.com/thoughtspot/swift-embed-sdk
I think you are using that anyways.
Thanks.
GitHub
GitHub - thoughtspot/swift-embed-sdk
Contribute to thoughtspot/swift-embed-sdk development by creating an account on GitHub.
our code is based on Reac Native
Here is the code snippet
trying to call this to get auth token, in my react-native code
const response = await fetch('https://<searver>.thoughtspot.cloud/api/rest/2.0/auth/token/full', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json' },
body: JSON.stringify(requestBody),
});
const requestBody = {
"username": "<username>",
"validity_time_in_sec": 300,
"auto_create": false,
"secretKey": "<secret>"
};
"@thoughtspot/rest-api-sdk": "^2.4.1",
"@thoughtspot/visual-embed-sdk": "^1.33.9",
@yuichirio_ha the token was valid - it authenticate the user for a web session. However it failed for mobile specifically.
Hey @Vasu Pabbaraju I meant thoughtspot server/cluster version.
Also we are using react-native-embed sdk right ?
https://www.npmjs.com/package/@thoughtspot/react-native-embed-sdk?activeTab=readme
I got confused as you mentioned visual-embed-sdk.
Also we have an example code for the react-native-embed-sdk : https://github.com/thoughtspot/developer-examples/tree/main/mobile/react-native-embed-sdk
Please refer to this also if some setup or code related usage of the sdk.
I tested with latest: react-native-embed-sdk with ios now.
If none of the above resolves. You can add the findings. Or else we can connect tomorrow IST hours if possible.
Thanks.
GitHub
developer-examples/mobile/react-native-embed-sdk at main · thought...
Example apps/solutions for Developers using ThoughtSpot - thoughtspot/developer-examples
I am using following
"@thoughtspot/react-native-embed-sdk": "^0.0.2-beta",
I have reviewed the sample code , issue I am facing is here , when I replaced "https://your-backend.com/api/get-ts-token'" with "https://<searver>.thoughtspot.cloud/api/rest/2.0/auth/token/full" network call is failing.
getAuthToken: async () => {
// Example: Fetch token from your backend
// const response = await fetch('https://your-backend.com/api/get-ts-token');
// const data = await response.json();
// return data.token;
return "YOUR_AUTH_TOKEN"; // Replace with actual token retrieval
}
am i calling wrong endpoint?
Hey @Vasu Pabbaraju -
So as you said it worked with your backend endpoint. So, it's not the issue with sdk.
Now for the issue for getting token directly from the endpoint. Please check below function and you can use something similar.
Also for your usage of direct api - use it something like this - I just tested it : With secret key. If you want to use direct endpoint we need these headers also.
Hi @Vasu Pabbaraju , just wanted to follow up - did the above help resolve the issue you're facing?
yes this issue is resolved
@Nicolas @yuichirio_ha reallt appreciate your help on this
Now, trying to resolve an MCP issue...
here is the issue i am facing while testing MCP using developer-examples fast-mcp.
1. when I use "(Sample) Retail - Apparel" datasource, MCP getAnswer tool responds with some answer without failure. But when use 'frame_url' attribute to see the graph. I get "we could not complete your request" error
2. when I use our orgs datasource with MCP , i get following error
Body: {"error":{"message":{"debug":{"debug":"No answer found for your query.","code":10004}}}}
Any help on this is greatly appreciated.

CC: @shikharTS can you PTAL. @Justin Mathew
Replied on the 2nd thread