fix: TryLoginAsync reported success inverted - #40
Merged
Merged
Conversation
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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DPXtTDGbCQ6GebnuvxV2s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
TryLoginAsyncpassesuser == nullas thesuccessargument ofVRChatLoginResult:So the result is inverted on both paths that don't throw:
userSuccessfalseLoginAsyncreturned nulltrueLoginAsyncthrewfalseA successful login reports failure with a null
Exception. That's indistinguishable from a silent failure, so the natural conclusion is bad credentials — which is how I found it, after a while of being certain my credentials were wrong.VRChatLoginResult's own documentation is unambiguous about the intent:The fix
user != nullfor success, plus a real exception on the failure path.The second part is worth a note:
LoginAsyncreturnsnullwhen the finalGetCurrentUserresponse isn't200 OK, and discards the status.Success = false, Exception = nullleft a caller with nothing to act on, log, or report to a user. It now carries anUnauthorizedAccessExceptionso the failure is at least nameable.Notes
wrapper/VRChat.API/Client/VRChat.csis touched — no generated code undersrc/.!result.Successwill need to drop the negation. Given the current behaviour makesTryLoginAsyncunusable as documented, I'd expect most callers to be usingLoginAsyncdirectly instead.src/VRChat.API/VRChat.API.csprojin Release.Not fixed here, but related
LoginAsyncswallowing the status makes401,403,429and a Cloudflare WAF block indistinguishable to a caller — they all surface asnull. That matters for anything that needs to respond differently to each (re-auth vs back off vs tell the operator). Happy to open a separate PR if you'd like that changed, since it's a larger behavioural question than this one.🤖 Generated with Claude Code
https://claude.ai/code/session_015DPXtTDGbCQ6GebnuvxV2s