Help with server.auth.sign_in
Describe the bug i can't login and have the server.auth.sign_in.
tableau_auth = TSC.TableauAuth('USERNAME', 'PASSWORD', 'SITENAME') server = TSC.Server('http://SERVER_URL')
i don't now with i put wrong information on TSC.TableauAuth and TSC.Server. On Username and Password is ok for me. On SERVER_URL i put the site of the company, the same i put when i sign in tableau server to put my username and password, and after i login teh site put another thing after / this thing i put on sitename
example http://analytics.work.com.br username: my_user Password: my_pass after that the site change for http://analytics.work.com.br/POCtableau
Versions
- Tableau Server version
- Python version 3.11.5
- TSC library Version: 0.30
To Reproduce
import tableauserverclient as TSC
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
tableau_auth = TSC.TableauAuth('my_user', 'my_pass', 'POCtableau')
server = TSC.Server('https://analytics.work.com.br')
server.add_http_options({'verify': False})
with server.auth.sign_in(tableau_auth):
all_datasources, pagination_item = server.datasources.get()
print("\nThere are {} datasources on site: ".format(pagination_item.total_available))
print([datasource.name for datasource in all_datasources])
Results
NotSignedInError: (b'<?xml version=\'1.0\' encoding=\'UTF-8\'?><tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api [https://help.tableau.com/samples/en-us/rest_api/ts-api_2_4.xsd"><error](https://help.tableau.com/samples/en-us/rest_api/ts-api_2_4.xsd%22%3E%3Cerror) code="401001"><summary>Erro de logon</summary><detail>Erro ao entrar no Tableau Server (16)</detail></error></tsResponse>', 'https://analytics.work.com.br'//api/2.4/auth/signin')
If i make without urllib3
tableau_auth = TSC.TableauAuth('my_user', 'my_pass', 'POCtableau')
server = TSC.Server('https://analytics.work.com.br')
server.auth.sign_in(tableau_auth)
the result is
SSLError: HTTPSConnectionPool(host='analytics.work.com.br', port=443): Max retries exceeded with url: /api/2.4/auth/signin (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1006)')))
for the second part: you shouldn't need urllib3, because that's exactly what this line is doing:
server.add_http_options({'verify': False})
For signing in: nothing looks wrong immediately, and that's the most general login error response. Try running these lines before sign in - this will verify that you've got a valid connection to the server.
server = TSC.Server(server_url)
print("Connected to {}".format(server.server_info.baseurl))
print("Server information: {}".format(server.server_info))
One idea: if you are able to log in to the webpage, then go to your user account (from the circle at the top right) and check what it says for 'username'.
When i run this lines, the print is
Connected to https://analytics.work.com.br/api/2.4/serverInfo Server information: <Endpoint ServerInfoItem: [product version: 2023.3.4, build no.:20233.24.0314.1442, REST API version:3.21]>
i have to change de rest api version from 2.4 from 3.21? if say yes, i do this
tableau_auth = TSC.TableauAuth('my_user', 'my_pass', 'POCtableau')
server = TSC.Server('https://analytics.work.com.br')
server.add_http_options({'verify': False}
server.use_server_version()
server.auth.sign_in(tableau_auth)
and have this error:
NotSignedInError: (b'<?xml version=\'1.0\' encoding=\'UTF-8\'?><tsResponse xmlns="http://tableau.com/api" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://tableau.com/api [https://help.tableau.com/samples/en-us/rest_api/ts-api_3_21.xsd"><error](https://help.tableau.com/samples/en-us/rest_api/ts-api_3_21.xsd%22%3E%3Cerror) code="401001"><summary>Erro de logon</summary><detail>Erro ao entrar no Tableau Server (16)</detail></error></tsResponse>', 'https://analytics.work.com.br/api/3.21/auth/signin')
Did you check your username? I think you might need to check with your server admin, they should be able to see the logs that say why your login isn't working.
Can you try creating a Personal Access Token and see if that allows you to sign in?
If your server is configured for multi-factor authentication or some form of single-sign-on, then using username and password may not work.
Tried using Personal Access Token and get the same Error 401001 :(