<@U06CBKL5W7L> How could I use different authentic...
# singer-tap-development
h
@aaronsteers How could I use different authenticators given a certain condition? Use case is in WooCommerce, if you have your shop on
http
then you have to use
OAuth 1
but if on
https
you have to use
OAuth 2
https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication-over-http
e
given that the stream has access to tap config, would something like this work
Copy code
@property
def authenticator(self):
    """Return a new authenticator object."""
    if self.config["url"].startswith("https"):
        return OAuth2Authenticator.create_for_stream(self)
    else:
        return OAuth1Authenticator.create_for_stream(self)
a
Yeah, @edgar_ramirez_mondragon. That should work! Also, @hassan_syyid you could implement two different Stream classes, which similarly each use their own authenticator.
We designed with the expectation that Streams in a tap might have different authentication protocols so you should have a variety of options.
The harder thing is actually getting all streams to reuse the same authenticator, which is a task @edgar_ramirez_mondragon and I are also looking at.
h
Woohoo, new Singer tap for WooCommerce built on the SDK (the one on singer-io was archived and didn’t even follow the spec properly for handling schemas)
j
@hassan_syyid congratulations on building the tap! I actually used WooCommerce to learn how to develop on Meltano SDK and have done the "orders" part. Would be happy to add this into your repo so it's better maintained? The only thing I found about WooCommerce is it seems everyones stores are set up differently so the orders schema seems to vary for each store
h
@jazzy Sure, that makes sense. If you’d like to submit a PR that’d be great