From f4ada1e41c39726b8325e1fedc14fd7df17ec9eb Mon Sep 17 00:00:00 2001 From: Sarmad Wahab Date: Sat, 12 Sep 2026 14:06:32 -0500 Subject: [PATCH] fix: TryLoginAsync reported success inverted TryLoginAsync passed `user == null` as the `success` argument of VRChatLoginResult, so the result was inverted on both paths that did not throw: login succeeded (user != null) -> Success = false, Exception = null login returned null -> Success = true, Exception = null A successful login therefore reported failure with no exception to inspect, which is indistinguishable from a silent failure -- the natural conclusion being bad credentials. Also replaces the null Exception on the failure path. LoginAsync returns null when the final GetCurrentUser response is not 200 OK and discards the status, so `Success = false, Exception = null` gave a caller nothing to act on or report. It now carries an UnauthorizedAccessException. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_015DPXtTDGbCQ6GebnuvxV2s --- wrapper/VRChat.API/Client/VRChat.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wrapper/VRChat.API/Client/VRChat.cs b/wrapper/VRChat.API/Client/VRChat.cs index fba7e622..8d588e06 100644 --- a/wrapper/VRChat.API/Client/VRChat.cs +++ b/wrapper/VRChat.API/Client/VRChat.cs @@ -372,7 +372,14 @@ public async Task TryLoginAsync(CancellationToken ct = defaul return new VRChatLoginResult(false, exception); } - return new VRChatLoginResult(user == null, null); + if (user != null) + return new VRChatLoginResult(true, null); + + // LoginAsync returns null when the final GetCurrentUser response was not 200 OK, and + // discards the status. Surface a concrete exception rather than reporting failure with + // no explanation, which is indistinguishable from a bug in the caller. + return new VRChatLoginResult(false, new UnauthorizedAccessException( + "Login did not complete: VRChat did not return a current user.")); } ///