Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python sdk auth bug #8230

Closed
chunyang-wen opened this issue Mar 24, 2022 · 3 comments · Fixed by #8343 or #8367
Closed

python sdk auth bug #8230

chunyang-wen opened this issue Mar 24, 2022 · 3 comments · Fixed by #8343 or #8367

Comments

@chunyang-wen
Copy link

Try to use BearerToken as the authentication method, but it seems that there are bugs here.

Argo-workflows version

Name: argo-workflows
Version: 6.3.1
Summary: Argo Workflows API
Home-page:
Author: OpenAPI Generator community
Author-email: [email protected]
License: UNKNOWN
Location: /Users/chunyang/anaconda3/envs/py38/lib/python3.8/site-packages
Requires: python-dateutil, urllib3
Required-by:

Reproduce code

import os
from pprint import pprint

import yaml

import argo_workflows
from argo_workflows.api import workflow_service_api


os.environ["ARGO_TOKEN"] = "ZZZ"

api_key = {"BearerToken": os.environ["ARGO_TOKEN"]}
api_key_prefix = {"BearerToken": "Bearer"}
host = "https://localhost:2746" # url of argo server
namespace = "argo"
configuration = argo_workflows.Configuration(
    host=host,
    api_key=api_key,
    api_key_prefix=api_key_prefix,
)
configuration.verify_ssl = False

api_client = argo_workflows.ApiClient(configuration)
api_instance = workflow_service_api.WorkflowServiceApi(api_client)
resp = api_instance.list_workflows(namespace, async_req=False)
pprint(resp)

Token from here

https://argoproj.github.io/argo-workflows/access-token/#token-creation

curl got correct results.

curl --request GET --url https://localhost:2746/api/v1/workflows/default -H "Authorization: Bearer ${TOKEN}"

{"metadata":{"resourceVersion":"80426099"},"items":null}%

Two problems here

No auth is passed in

image

When no workflows executed, list_workflows fails

By manually passed auth = ["BearerToken"] to fix previous bug, I got following error. Argo server is deployed from ground up before accessing it. No workflows have been executed.

image

@alexec
Copy link
Contributor

alexec commented Mar 27, 2022

There might be two bugs here. Can you make sure you create a workflow before you make a list operation?

@terrytangyuan
Copy link
Member

terrytangyuan commented Mar 27, 2022

This seems to be the same issue as #7781. Somehow the generated code passes None to args and return values.

@alexec alexec removed the triage label Mar 27, 2022
alexec added a commit that referenced this issue Apr 11, 2022
@chunyang-wen
Copy link
Author

@alexec Any release plan for this fix?

@sarabala1979 sarabala1979 mentioned this issue Apr 14, 2022
85 tasks
alexec added a commit that referenced this issue Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants