Skip to content

Commit f3925e4

Browse files
typo fixes
1 parent 228b93f commit f3925e4

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

modules/ROOT/pages/trusted-auth-sdk.adoc

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ When `init()` is called, the SDK checks if there is an existing ThoughtSpot sess
1313

1414
Cookieless authentication, specified using `AuthType.TrustedAuthTokenCookieless`, uses the token as a bearer token for all subsequent requests to ThoughtSpot, without establishing a session in the browser.
1515

16-
Cookie-based authentication, specified using `AuthType.TrustedAuthToken`, uses the token to create a session in the browser immediately, and does not use the token afterward, instead relying on the established session with the ThoughtSpot instance.
16+
Cookie-based authentication, specified using `AuthType.TrustedAuthToken`, uses the token to create a session in the browser immediately. It does not use the token afterward; instead, it relies on the established session with the ThoughtSpot instance.
1717

1818
For the request to be *secure*, the user in the browser cannot modify the request or make their own valid request to the *token request service* in a way that requests a token for any other user.
1919

20-
The `autoLogin: true` property in the `init()` function causes the Visual Embed SDK to request a new token before the token or the session expires, so that a user never sees the ThoughtSpot embed component in a signed-out state.
20+
The `autoLogin: true` property in the `init()` function causes the Visual Embed SDK to request a new token before the current token or the session expires, so that a user never sees the embedded ThoughtSpot component in a signed-out state.
2121

2222
== Define token request service
2323
There are two options in the `init()` function to define the request to the *token request service*: `authEndpoint` or `getAuthToken`.
@@ -53,7 +53,7 @@ init({
5353
});
5454
----
5555

56-
You can even use the callback function to reference a hard-coded login token, in a testing or other appropriate situation. Remember, it must return a Promise that resolves with the token:
56+
You can even use the callback function to reference a hard-coded login token in a testing or other appropriate situation. Remember, it must return a Promise that resolves with the token:
5757

5858
[source,JavaScript]
5959
----
@@ -91,7 +91,7 @@ The Visual Embed SDK provides a link:https://developers.thoughtspot.com/docs/Fun
9191
Please see the documentation on xref:rest-apiv2-js.adoc[REST API V2.0 within a browser] for further explanation and example code.
9292

9393
=== Multiple user sessions in one browser
94-
Cookieless authentication is also useful for scenarios where the embedding application allows for being logged into multiple user accounts in different tabs, or quick switches between users. Cookie-based authentication restricts the whole browser to a single logged-in user per ThoughtSpot instance, while cookie-less allows each tab to use a different token without conflicts.
94+
Cookieless authentication is also useful for scenarios where the embedding application allows for being logged into multiple user accounts in different tabs, or quick switches between users. Cookie-based authentication restricts the whole browser to a single logged-in user per ThoughtSpot instance, while cookieless allows each tab to use a different token without conflicts.
9595

9696
== Code examples
9797
The only difference between cookie-based trusted authentication and cookieless authentication in the `init()` function is the value used for the `authType` property.
@@ -105,39 +105,39 @@ The following example shows a custom callback function with a custom request usi
105105
let tsToken; // global scope to store token for other REST API requests
106106
init({
107107
thoughtSpotHost: tsURL,
108-
authType: AuthType.TrustedAuthTokenCookieless,
108+
authType: AuthType.TrustedAuthTokenCookieless,
109109
getAuthToken: getAuthToken,
110110
autoLogin: true
111-
});
111+
});
112112
113113
function async getAuthToken {
114-
const tokenURL = tokenServiceURL + "/gettoken/";
115-
console.log("calling token server at " + tokenURL);
116-
117-
const timeoutSecs = 5 * 1000; // seconds to milliseconds
118-
119-
const response = await timeout(timeoutSecs, fetch(
120-
tokenURL,
121-
{
122-
method: 'POST',
123-
mode: 'cors',
124-
cache: 'no-cache',
125-
headers: {
126-
// This Token Request Service returns the token as a plain-text string
127-
'Content-Type': "text/plain",
128-
// Custom header for passing a JWT with auth details from the web app to the token request service
129-
// Instead the token request service may have access to a user session with the details
130-
'X-Auth-Token': authJWT
131-
},
132-
credentials: 'include'
133-
}
134-
))
135-
136-
// Token request service returns plain-text string of the token
137-
// set the global tsToken variable for using the token for separate REST API requests
138-
tsToken = response.text();
139-
// Must return for the Promise to be completed
140-
return response.text()
114+
const tokenURL = tokenServiceURL + "/gettoken/";
115+
console.log("calling token server at " + tokenURL);
116+
117+
const timeoutSecs = 5 * 1000; // seconds to milliseconds
118+
119+
const response = await timeout(
120+
timeoutSecs,
121+
fetch(tokenURL, {
122+
method: 'POST',
123+
mode: 'cors',
124+
cache: 'no-cache',
125+
headers: {
126+
// This Token Request Service returns the token as a plain-text string
127+
'Content-Type': "text/plain",
128+
// Custom header for passing a JWT with auth details from the web app to the token request service
129+
// Instead the token request service may have access to a user session with the details
130+
'X-Auth-Token': authJWT
131+
},
132+
credentials: 'include'
133+
})
134+
)
135+
136+
// Token request service returns plain-text string of the token
137+
// set the global tsToken variable for using the token for separate REST API requests
138+
tsToken = response.text();
139+
// Must return for the Promise to be completed
140+
return response.text()
141141
}
142142
----
143143

@@ -163,7 +163,7 @@ init({
163163
return fetch('https://my-backend.app/ts-token')
164164
.then((response) => response.json())
165165
.then((data) => data.token);
166-
});
166+
});
167167
----
168168

169169
=== Cookieless authentication examples
@@ -190,5 +190,5 @@ init({
190190
.then((response) => response.json())
191191
.then((data) => data.token);
192192
}
193-
});
193+
});
194194
----

0 commit comments

Comments
 (0)