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
Copy file name to clipboardExpand all lines: modules/ROOT/pages/trusted-auth-sdk.adoc
+35-35Lines changed: 35 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ When `init()` is called, the SDK checks if there is an existing ThoughtSpot sess
13
13
14
14
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.
15
15
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.
17
17
18
18
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.
19
19
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.
21
21
22
22
== Define token request service
23
23
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({
53
53
});
54
54
----
55
55
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:
57
57
58
58
[source,JavaScript]
59
59
----
@@ -91,7 +91,7 @@ The Visual Embed SDK provides a link:https://developers.thoughtspot.com/docs/Fun
91
91
Please see the documentation on xref:rest-apiv2-js.adoc[REST API V2.0 within a browser] for further explanation and example code.
92
92
93
93
=== 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.
95
95
96
96
== Code examples
97
97
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
105
105
let tsToken; // global scope to store token for other REST API requests
106
106
init({
107
107
thoughtSpotHost: tsURL,
108
-
authType: AuthType.TrustedAuthTokenCookieless,
108
+
authType: AuthType.TrustedAuthTokenCookieless,
109
109
getAuthToken: getAuthToken,
110
110
autoLogin: true
111
-
});
111
+
});
112
112
113
113
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
0 commit comments