EmGarr
10/20/2020, 4:01 PMheaders = {'Authorization': "Basic {}".format(XXXXX)}
client = prefect.Client()
client.attach_headers(headers)
However, when the agent deploys a flow we hit a small issue:
1. The docker is runned with the following command: prefect execute flow-run
2. Inside the docker we run it leads to prefect.execute.cli
with _execute_flow_run
:
client = Client()
result = client.graphql(query) # Authorization error
Is there a simple way to avoid this issue and being able to add BasicAuth to the client?
We could maybe add an env variable which would select the proper auth method by the client (example):
https://github.com/PrefectHQ/prefect/blob/bd6e47379594d4e26e6810380482320eeee714ae/src/prefect/client/client.py#L385
def select_auth_method(token):
if config.AUTH.BASIC:
return "Basic {}".format(token)
# else OAuth
return "Basic {}".format(token)
if token:
headers["Authorization"] = "Bearer {}".format(token)
Chris White
10/20/2020, 4:14 PMEmGarr
10/20/2020, 4:23 PMChris White
10/20/2020, 4:25 PMEmGarr
10/20/2020, 4:26 PM