Skip to content

Commit

Permalink
Fix cookies generation by adding path and domain (#20)
Browse files Browse the repository at this point in the history
* Fix cookies generation

* Add changes
  • Loading branch information
jellejurre authored Aug 9, 2024
1 parent d52a777 commit dddafa0
Show file tree
Hide file tree
Showing 16 changed files with 269 additions and 263 deletions.
6 changes: 6 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ sed -i 's/cookies = new CookieContainer()/cookies = CookieContainer/' ./src/VRCh
# Add result to CookieContainer
sed -i '/result.Cookies.Add(cookie);/a \ client.CookieContainer.Add(cookie);' ./src/VRChat.API/Client/ApiClient.cs

for file in $(find ./src/VRChat.API -name '*.cs'); do
sed -i 's/new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"))/new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "\/", "vrchat.com")/g' $file
sed -i 's/new Cookie("twoFactorAuth", this.Configuration.GetApiKeyWithPrefix("twoFactorAuth"))/new Cookie("twoFactorAuth", this.Configuration.GetApiKeyWithPrefix("twoFactorAuth"), "\/", "vrchat.com")/g' $file
sed -i 's/new Cookie(cookie.Name, cookie.Value)/new Cookie(cookie.Name, cookie.Value, cookie.Path, cookie.Domain)/g' $file
done

# 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
Expand Down
32 changes: 16 additions & 16 deletions src/VRChat.API/Api/AuthenticationApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> DeleteUserWithHttpInfo(string
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -851,7 +851,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> DeleteUserWithHttpInfo(string
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -919,7 +919,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> GetCurrentUserWithHttpInfo(int
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}
// authentication (authHeader) required
// http basic authentication required
Expand All @@ -931,7 +931,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> GetCurrentUserWithHttpInfo(int
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("twoFactorAuth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("twoFactorAuth", this.Configuration.GetApiKeyWithPrefix("twoFactorAuth")));
localVarRequestOptions.Cookies.Add(new Cookie("twoFactorAuth", this.Configuration.GetApiKeyWithPrefix("twoFactorAuth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1001,7 +1001,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> GetCurrentUserWithHttpInfo(int
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}
// authentication (authHeader) required
// http basic authentication required
Expand All @@ -1013,7 +1013,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> GetCurrentUserWithHttpInfo(int
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("twoFactorAuth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("twoFactorAuth", this.Configuration.GetApiKeyWithPrefix("twoFactorAuth")));
localVarRequestOptions.Cookies.Add(new Cookie("twoFactorAuth", this.Configuration.GetApiKeyWithPrefix("twoFactorAuth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1081,7 +1081,7 @@ public VRChat.API.Client.ApiResponse<Success> LogoutWithHttpInfo(int operationIn
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1151,7 +1151,7 @@ public VRChat.API.Client.ApiResponse<Success> LogoutWithHttpInfo(int operationIn
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1229,7 +1229,7 @@ public VRChat.API.Client.ApiResponse<Verify2FAResult> Verify2FAWithHttpInfo(TwoF
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1309,7 +1309,7 @@ public VRChat.API.Client.ApiResponse<Verify2FAResult> Verify2FAWithHttpInfo(TwoF
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1387,7 +1387,7 @@ public VRChat.API.Client.ApiResponse<Verify2FAEmailCodeResult> Verify2FAEmailCod
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1467,7 +1467,7 @@ public VRChat.API.Client.ApiResponse<Verify2FAEmailCodeResult> Verify2FAEmailCod
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1535,7 +1535,7 @@ public VRChat.API.Client.ApiResponse<VerifyAuthTokenResult> VerifyAuthTokenWithH
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1605,7 +1605,7 @@ public VRChat.API.Client.ApiResponse<VerifyAuthTokenResult> VerifyAuthTokenWithH
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1683,7 +1683,7 @@ public VRChat.API.Client.ApiResponse<Verify2FAResult> VerifyRecoveryCodeWithHttp
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1763,7 +1763,7 @@ public VRChat.API.Client.ApiResponse<Verify2FAResult> VerifyRecoveryCodeWithHttp
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down
36 changes: 18 additions & 18 deletions src/VRChat.API/Api/AvatarsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ public VRChat.API.Client.ExceptionFactory ExceptionFactory
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -815,7 +815,7 @@ public VRChat.API.Client.ExceptionFactory ExceptionFactory
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -892,7 +892,7 @@ public VRChat.API.Client.ApiResponse<Avatar> DeleteAvatarWithHttpInfo(string ava
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -971,7 +971,7 @@ public VRChat.API.Client.ApiResponse<Avatar> DeleteAvatarWithHttpInfo(string ava
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1048,7 +1048,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetAvatarWithHttpInfo(string avatar
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1127,7 +1127,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetAvatarWithHttpInfo(string avatar
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1273,7 +1273,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetAvatarWithHttpInfo(string avatar
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1421,7 +1421,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetAvatarWithHttpInfo(string avatar
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1498,7 +1498,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetOwnAvatarWithHttpInfo(string use
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1577,7 +1577,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetOwnAvatarWithHttpInfo(string use
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1723,7 +1723,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetOwnAvatarWithHttpInfo(string use
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1871,7 +1871,7 @@ public VRChat.API.Client.ApiResponse<Avatar> GetOwnAvatarWithHttpInfo(string use
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -1948,7 +1948,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> SelectAvatarWithHttpInfo(strin
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -2027,7 +2027,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> SelectAvatarWithHttpInfo(strin
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -2104,7 +2104,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> SelectFallbackAvatarWithHttpIn
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -2183,7 +2183,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> SelectFallbackAvatarWithHttpIn
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -2264,7 +2264,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> SelectFallbackAvatarWithHttpIn
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down Expand Up @@ -2347,7 +2347,7 @@ public VRChat.API.Client.ApiResponse<CurrentUser> SelectFallbackAvatarWithHttpIn
// cookie parameter support
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("auth")))
{
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth")));
localVarRequestOptions.Cookies.Add(new Cookie("auth", this.Configuration.GetApiKeyWithPrefix("auth"), "/", "vrchat.com"));
}

// make the HTTP request
Expand Down
Loading

0 comments on commit dddafa0

Please sign in to comment.