From f8e3ce2a51b37a53734bfaa4d3173139be37ec60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Dudzi=C5=84ski?= <56404247+oskvr37@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:18:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20#166=20(#167)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * set new default creds, add function to get creds from env * add instruction for TIDDL_CLIENT * add base64 for client creds --- README.md | 6 ++++++ tiddl/auth.py | 25 +++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9dc19c2..ad93e04 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,12 @@ Example CLI usage: TIDDL_PATH=~/custom/tiddl tiddl auth login ``` +## Auth stopped working? + +Set `TIDDL_AUTH` environment variable to use another credentials. + +TIDDL_AUTH=; + # Development Clone the repository diff --git a/tiddl/auth.py b/tiddl/auth.py index 3bac576..97ae96a 100644 --- a/tiddl/auth.py +++ b/tiddl/auth.py @@ -1,4 +1,6 @@ import logging +import base64 +from os import environ from requests import request @@ -6,10 +8,29 @@ from tiddl.exceptions import AuthError from tiddl.models import auth AUTH_URL = "https://auth.tidal.com/v1/oauth2" -CLIENT_ID = "zU4XHVVkc2tDPo4t" -CLIENT_SECRET = "VJKhDFqJPqvsPVNBV6ukXTJmwlvbttP7wlMlrc72se4=" +def get_auth_credentials() -> tuple[str, str]: + ENV_KEY = "TIDDL_AUTH" + + client_id, client_secret = ( + base64.b64decode( + "N203QXAwSkM5ajFjT00zbjt2UkFkQTEwOHRsdmtKcFRzR1pTOHJHWjd4VGxiSjBxYVoySzlzYUV6c2dZPQ==" + ) + .decode() + .split(";") + ) + + env_value = environ.get(ENV_KEY, None) + + if env_value: + client_id, client_secret = env_value.split(";") + + return client_id, client_secret + + +CLIENT_ID, CLIENT_SECRET = get_auth_credentials() + logger = logging.getLogger(__name__)