singer-io / tap-taboola

A Singer tap for extracting data from the Taboola API
GNU Affero General Public License v3.0
2 stars 12 forks source link

Fallback to client creds auth #5

Closed dmosorast closed 5 years ago

dmosorast commented 5 years ago

According to Taboola's Authentication docs, Client Credentials authentication is equivalent to Password authentication, token-wise. Since the tap isn't using the refresh token retrieved using password auth.

This PR adds flexibility by allowing a fallback to use the client_id and client_secret only to retrieve a token, if Password Auth returns a 400. It also relies on the account_id returned through the token_details endpoint and treats this as a warning, rather than a hard error.

The reasoning is that the true credentials to authenticate are the client_id and client_secret, and the other pieces of validation are extras, and applied poorly.

Note This tap could use a revisiting to be up to date with the most recent Singer patterns and practices (e.g., metadata, field selection, discovery, etc.).