Skip to content

Commit 163426a

Browse files
authored
fix: TryLoginAsync reported success inverted (#40)
1 parent 782844e commit 163426a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎wrapper/VRChat.API/Client/VRChat.cs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,14 @@ public async Task<VRChatLoginResult> TryLoginAsync(CancellationToken ct = defaul
372372
return new VRChatLoginResult(false, exception);
373373
}
374374

375-
return new VRChatLoginResult(user == null, null);
375+
if (user != null)
376+
return new VRChatLoginResult(true, null);
377+
378+
// LoginAsync returns null when the final GetCurrentUser response was not 200 OK, and
379+
// discards the status. Surface a concrete exception rather than reporting failure with
380+
// no explanation, which is indistinguishable from a bug in the caller.
381+
return new VRChatLoginResult(false, new UnauthorizedAccessException(
382+
"Login did not complete: VRChat did not return a current user."));
376383
}
377384

378385
/// <inheritdoc/>

0 commit comments

Comments
 (0)