diff --git a/generate.sh b/generate.sh index edd523d..5615132 100755 --- a/generate.sh +++ b/generate.sh @@ -37,6 +37,9 @@ for file in $(find ./src/VRChat.API -name '*.cs'); do sed -i 's/new Cookie(cookie.Name, cookie.Value)/new Cookie(cookie.Name, cookie.Value, cookie.Path, cookie.Domain)/g' $file done +# Fix username and password encoding +sed -i 's/VRChat.API.Client.ClientUtils.Base64Encode(this.Configuration.Username + \":\" + this.Configuration.Password)/VRChat.API.Client.ClientUtils.Base64Encode(System.Web.HttpUtility.UrlEncode(this.Configuration.Username) + ":" + System.Web.HttpUtility.UrlEncode(this.Configuration.Password))/g' src/VRChat.API/Api/AuthenticationApi.cs + # Fix fields in csproj sed -i 's/OpenAPI Library/VRChat API Library for .NET/' src/VRChat.API/VRChat.API.csproj sed -i 's/A library generated from a OpenAPI doc/VRChat API Library for .NET/' src/VRChat.API/VRChat.API.csproj diff --git a/src/VRChat.API/Api/AuthenticationApi.cs b/src/VRChat.API/Api/AuthenticationApi.cs index a9f7f21..74e49e2 100644 --- a/src/VRChat.API/Api/AuthenticationApi.cs +++ b/src/VRChat.API/Api/AuthenticationApi.cs @@ -925,7 +925,7 @@ public VRChat.API.Client.ApiResponse GetCurrentUserWithHttpInfo(int // http basic authentication required if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + VRChat.API.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + VRChat.API.Client.ClientUtils.Base64Encode(System.Web.HttpUtility.UrlEncode(this.Configuration.Username) + ":" + System.Web.HttpUtility.UrlEncode(this.Configuration.Password))); } // authentication (twoFactorAuthCookie) required // cookie parameter support @@ -1007,7 +1007,7 @@ public VRChat.API.Client.ApiResponse GetCurrentUserWithHttpInfo(int // http basic authentication required if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + VRChat.API.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + VRChat.API.Client.ClientUtils.Base64Encode(System.Web.HttpUtility.UrlEncode(this.Configuration.Username) + ":" + System.Web.HttpUtility.UrlEncode(this.Configuration.Password))); } // authentication (twoFactorAuthCookie) required // cookie parameter support