Skip to content

Zendesk provider doesn't support tokens even though user+password is deprecated #64589

@fjmacagno

Description

@fjmacagno

Apache Airflow Provider(s)

zendesk

Versions of Apache Airflow Providers

zendesk 4.11.2

Apache Airflow version

2.11.0

Operating System

Ubuntu, OSX

Deployment

Official Apache Airflow Helm Chart

Deployment details

Error is occurring in local development on docker.

What happened

I am trying to update to the latest version of the zendesk provider, but running into auth problems. Trying to connect to zendesk with a token is failing with zenpy.lib.exception.APIException: {"error": "Couldn't authenticate you"}. The same host/user/password connection field combo works fine with the zdesk version of the provider (2.x), so i know the creds are good.

What you think should happen instead

I suspect the problem is that the provider only supports "password" auth, which is now deprecated. In particular, the init line Zenpy(domain=domain, subdomain=subdomain, email=conn.login, password=conn.password) in the hook suggests this, zenpy can take a "token" parameter instead. The connection should have a way to specify that the password fields is a token instead of a password, either with a new field or an extra arg or something.

How to reproduce

Use a token for authentication using the latest version of the zendesk provider and attempt to run any api command.

Anything else

Replacing calling the hook's get_conn() fn with

        conn = BaseHook.get_connection("zendesk")
        domain = ""
        subdomain: str | None = None
        if conn.host:
            domain = conn.host
            if conn.host.count(".") >= 2:
                dot_splitted_string = conn.host.rsplit(".", 2)
                subdomain = dot_splitted_string[0]
                domain = ".".join(dot_splitted_string[1:])
        zenpy_client = Zenpy(domain=domain, subdomain=subdomain, email=conn.login, token=conn.password)

works fine.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

As long as someone tells me what the correct solution is.

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions