From bd46e31c02e38bc4886272fbf79973d6a32fc62d Mon Sep 17 00:00:00 2001 From: Laura <85845965+Oestrogenproblem@users.noreply.github.com> Date: Sun, 16 Nov 2025 22:46:50 +0100 Subject: [PATCH 1/3] Fix login issue: URL encode username and password in `get_basic_auth_token` to handle special characters --- vrchatapi/configuration.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vrchatapi/configuration.py b/vrchatapi/configuration.py index c0481ac4..45724ff1 100644 --- a/vrchatapi/configuration.py +++ b/vrchatapi/configuration.py @@ -17,6 +17,7 @@ import multiprocessing import sys import urllib3 +import urllib.parse import six from six.moves import http_client as httplib @@ -396,8 +397,13 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password + + #URL encoding username/password to avoid issues with special characters + encoded_username = urllib.parse.quote(username) + encoded_password = urllib.parse.quote(password) + return urllib3.util.make_headers( - basic_auth=username + ':' + password + basic_auth=encoded_username + ':' + encoded_password ).get('authorization') def auth_settings(self): From 300381dbc475e46c7c189897ac9bcf70b1ac03f2 Mon Sep 17 00:00:00 2001 From: Laura <85845965+Oestrogenproblem@users.noreply.github.com> Date: Mon, 17 Nov 2025 15:53:19 +0100 Subject: [PATCH 2/3] Added patch for the URL encoding in `get_basic_auth_token` --- patches/encode_basic_auth.patch | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 patches/encode_basic_auth.patch diff --git a/patches/encode_basic_auth.patch b/patches/encode_basic_auth.patch new file mode 100644 index 00000000..cbbd9c3b --- /dev/null +++ b/patches/encode_basic_auth.patch @@ -0,0 +1,27 @@ +diff --git a/vrchatapi/configuration.py b/vrchatapi/configuration.py +index c0481ac4..45724ff1 100644 +--- a/vrchatapi/configuration.py ++++ b/vrchatapi/configuration.py +@@ -17,6 +17,7 @@ import logging + import multiprocessing + import sys + import urllib3 ++import urllib.parse + + import six + from six.moves import http_client as httplib +@@ -396,8 +397,13 @@ conf = vrchatapi.Configuration( + password = "" + if self.password is not None: + password = self.password ++ ++ #URL encoding username/password to avoid issues with special characters ++ encoded_username = urllib.parse.quote(username) ++ encoded_password = urllib.parse.quote(password) ++ + return urllib3.util.make_headers( +- basic_auth=username + ':' + password ++ basic_auth=encoded_username + ':' + encoded_password + ).get('authorization') + + def auth_settings(self): From 162aa09792fbe6f35a42153945080775dec1f534 Mon Sep 17 00:00:00 2001 From: Laura <85845965+Oestrogenproblem@users.noreply.github.com> Date: Mon, 17 Nov 2025 15:55:41 +0100 Subject: [PATCH 3/3] Added `encode_basic_auth.patch` to `generate.sh` --- generate.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generate.sh b/generate.sh index c849b6a4..b3e29ec2 100755 --- a/generate.sh +++ b/generate.sh @@ -38,4 +38,7 @@ patch ./vrchatapi/rest.py < ./patches/error_2fa_verify_readable.patch patch ./vrchatapi/configuration.py < ./patches/safe_param_symbols.patch # Boolean to lower str conversion for query parameters -patch ./vrchatapi/api_client.py < ./patches/query_param_bool.patch \ No newline at end of file +patch ./vrchatapi/api_client.py < ./patches/query_param_bool.patch + +# Add URL encoding to basic auth parameters +patch ./vrchatapi/configuration.py < ./patches/encode_basic_auth.patch \ No newline at end of file