-
Notifications
You must be signed in to change notification settings - Fork 447
Closed
Description
Describe the bug
I receive a "401002: Unauthorized Access" error when querying the jobs endpoint after authenticating with JWT. It appears that support for the jobs endpoint with JWT authentication was added in February 2025.
Versions
Details of your environment, including:
- Using Tableau Cloud
- Python version: 3.10.7
- TSC library version: 0.36
To Reproduce
scopes = [
"tableau:content:read",
"tableau:datasources:*",
"tableau:tasks:*",
"tableau:jobs:read"
]
payload = {
"iss": clientId,
"iat": datetime.datetime.now(datetime.timezone.utc),
"exp": datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(minutes=tokenExpiryInMinutes),
"jti": str(uuid.uuid4()),
"aud": "tableau",
"sub": username,
"scp": scopes,
}
def getJwt():
token = jwt.encode(
payload,
secretValue,
algorithm="HS256",
headers={
"kid": secretId,
"iss": clientId,
},
)
return token
jwt_token = getJwt()
tableau_auth = TSC.JWTAuth(jwt=jwt_token, site_id=site_id)
cloud = TSC.Server(server_address=server_url, use_server_version=True)
cloud.version = '3.25'
with cloud.auth.sign_in(tableau_auth):
all_jobs = list(TSC.Pager(cloud.jobs))
Results
tableauserverclient.server.endpoint.exceptions.FailedSignInError: Failed Sign In Error:
401002: Unauthorized Access
Invalid authentication credentials were provided.
Metadata
Metadata
Assignees
Labels
No labels