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
I hope you are well. I had a question. I am new to Trino/Starburst. I am using the following approach to connect to a starburst enterprise cluster using OAuth:
from sqlalchemy import create_engine
from trino.auth import OAuth2Authentication
engine = create_engine(
"trino://<username>@<host>:<port>/<catalog>",
connect_args={
"auth": OAuth2Authentication(),
"http_scheme": "https",
}
)
This is a FastAPI application running on Python3.11. I can run this service two ways locally:
via a docker container (based on python:3.11.10-slim image)
directly on my machine
When I run this fastapi app directly on my macbook and it tries to connect to starburst via trino-python-client, a browser window open prompting me to sign in to my company SSO. After I log in, I get the following window back:
After this, my query executes and runs successfully and I get results back from starburst.
The issue occurs when I run this same exact code in my docker container. It does not open up the browser window, which makes sense since it is running in a container. I tried to have the trino client output the link to the console using the following line:
connect_args["auth"] = OAuth2Authentication(redirect_auth_url_handler=ConsoleRedirectHandler())
With this change, I do see the link show in my console sporadically but even when I click on it, I still cannot connect to starburst. My fastapi application will try to connect for some time and then I get the following error:
TrinoAuthError trino.exceptions.TrinoAuthError) Exceeded max attempts while getting the token
I do have the ["external-authentication-token-cache"] installed in my virtual env.
To summarize:
I am unable to authenticate to my starburst enterprise cluser using the OAuth2Authentication() via the trino-python-client when running within a container.
Any help or guidance would be appreciated, thank you very much.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
I hope you are well. I had a question. I am new to Trino/Starburst. I am using the following approach to connect to a starburst enterprise cluster using OAuth:
This is a FastAPI application running on Python3.11. I can run this service two ways locally:
python:3.11.10-slim
image)When I run this fastapi app directly on my macbook and it tries to connect to starburst via trino-python-client, a browser window open prompting me to sign in to my company SSO. After I log in, I get the following window back:

After this, my query executes and runs successfully and I get results back from starburst.
The issue occurs when I run this same exact code in my docker container. It does not open up the browser window, which makes sense since it is running in a container. I tried to have the trino client output the link to the console using the following line:
connect_args["auth"] = OAuth2Authentication(redirect_auth_url_handler=ConsoleRedirectHandler())
With this change, I do see the link show in my console sporadically but even when I click on it, I still cannot connect to starburst. My fastapi application will try to connect for some time and then I get the following error:
TrinoAuthError trino.exceptions.TrinoAuthError) Exceeded max attempts while getting the token
I do have the
["external-authentication-token-cache"]
installed in my virtual env.To summarize:
I am unable to authenticate to my starburst enterprise cluser using the OAuth2Authentication() via the trino-python-client when running within a container.
Any help or guidance would be appreciated, thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions