singer-io / tap-zendesk

GNU Affero General Public License v3.0
16 stars 39 forks source link

Why using "access_token" when the authentication method is API Token? #126

Open mfs-homero-merino opened 1 year ago

mfs-homero-merino commented 1 year ago

https://github.com/singer-io/tap-zendesk/blob/2dc3cbb3425a115b4e6256313ce21ca6f20bb22a/tap_zendesk/streams.py#L151

My team is trying to use this tap with the API token authenticationn but when running ~/.virtualenv/tap-zendesk/bin/tap-zendesk --config tap-zendesk.conf --catalog catalog_zendesk.json, we're getting this error: INFO Using API Token authentication. INFO tickets: Starting sync INFO Syncing ticket_audits per ticket... INFO METRIC: {"type": "counter", "metric": "record_count", "value": 0, "tags": {"endpoint": "tickets"}} CRITICAL 'access_token' Traceback (most recent call last): File "/home/singer/.virtualenv/tap-zendesk/bin/tap-zendesk", line 33, in sys.exit(load_entry_point('tap-zendesk==1.7.5', 'console_scripts', 'tap-zendesk')()) File "/home/singer/.virtualenv/tap-zendesk/lib/python3.9/site-packages/singer/utils.py", line 229, in wrapped return fnc(*args, **kwargs) File "/home/singer/.virtualenv/tap-zendesk/lib/python3.9/site-packages/tap_zendesk/init.py", line 214, in main do_sync(client, parsed_args.catalog, state, parsed_args.config) File "/home/singer/.virtualenv/tap-zendesk/lib/python3.9/site-packages/tap_zendesk/init.py", line 144, in do_sync counter_value = sync_stream(state, config.get('start_date'), instance) File "/home/singer/.virtualenv/tap-zendesk/lib/python3.9/site-packages/tap_zendesk/sync.py", line 31, in sync_stream for (stream, record) in instance.sync(state): File "/home/singer/.virtualenv/tap-zendesk/lib/python3.9/site-packages/tap_zendesk/streams.py", line 330, in sync for ticket in tickets: File "/home/singer/.virtualenv/tap-zendesk/lib/python3.9/site-packages/tap_zendesk/streams.py", line 151, in get_objects for page in http.get_incremental_export(url, self.config['access_token'], self.request_timeout, start_time): KeyError: 'access_token'

The get_objects method in CursorBasedExportStreams class uses again the config file regardless of the authentication type which causes an error in the keys. If both keys are added in config file, by default the auth method selected is Oauth.

Any suggestion for this error? Kind regards!

mfs-homero-merino commented 1 year ago

image

dmnpignaud commented 4 months ago

This PR solves the problem but it has been closed for no obvious reason.

bdewilde commented 3 months ago

I just ran into this error myself. Definitely unexpected behavior to claim support for the API token approach to authorization, but then require OAuth under the hood.