Skip to content

Commit 9f42a46

Browse files
authored
Update sign-in-out.md
Revised page to address Issue #355 (add site specification on sign in)
1 parent 8b6747e commit 9f42a46

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

Diff for: docs/sign-in-out.md

+20-15
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,42 @@ title: Sign In and Out
33
layout: docs
44
---
55

6-
To sign in and out of Tableau Server, call the `Auth.sign_in` and `Auth.sign_out` functions like so:
6+
To sign in and out of Tableau Server, call the server's `.auth.signin` method in a`with` block.
77

88
```py
99
import tableauserverclient as TSC
1010

11-
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD')
12-
server = TSC.Server('http://SERVER_URL')
11+
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD', `SITENAME`)
12+
server = TSC.Server('https://SERVER_URL')
1313

14-
server.auth.sign_in(tableau_auth)
14+
with server.auth.sign_in(tableau_auth):
15+
# Do awesome things here!
16+
```
1517

16-
# Do awesome things here!
18+
The `SERVER_URL` is the URL of the Tableau server without subpaths. For local Tableau servers, in the form of: `https://www.MY_SERVER.com`. For Tableau Online, `https://10ax.online..tableau.com/`.
1719

18-
server.auth.sign_out()
19-
```
20+
`SITENAME` is same as the `contentURL`, or site subpath, of your full site URL. This parameter can be omitted when signing in to the Default site of a locally installed Tableau server.
21+
22+
Optionally, you can override the Tableau API version by adding `server.version = '<VERSION_NUMBER>'` before the `auth.signin` call.
23+
24+
The TSC library signs you out of Tableau Server when you exit out of the `with` block.
2025

2126
<div class="alert alert-info">
22-
<b>Note:</b> When you sign in, the TSC library manages the authenticated session for you, however it is still
23-
limited by the maximum session length (of four hours) on Tableau Server.
27+
<b>Note:</b> When you sign in, the TSC library manages the authenticated session for you, however the validity of the underlying
28+
credentials token is limited by the maximum session length set on your Tableau Server (2 hours by default).
2429
</div>
2530

26-
27-
Alternatively, for short programs, consider using a `with` block:
31+
An option to using a `with` block is to call the `Auth.sign_in` and `Auth.sign_out` functions explicitly.
2832

2933
```py
3034
import tableauserverclient as TSC
3135

3236
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD')
3337
server = TSC.Server('http://SERVER_URL')
3438

35-
with server.auth.sign_in(tableau_auth):
36-
# Do awesome things here!
37-
```
39+
server.auth.sign_in(tableau_auth)
3840

39-
The TSC library signs you out of Tableau Server when you exit out of the `with` block.
41+
# Do awesome things here!
42+
43+
server.auth.sign_out()
44+
```

0 commit comments

Comments
 (0)