-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Running nearly any async API call which requires any form of authentication (that is, the Auth cookie or similar to be present) results in 401 errors due to the cookie seemingly not being present. Running the same calls synchronously works fine, likewise when attempting to replicate manually via Insomnia.
It looks like it may be related to the fact that ApiClient.ExecAsync doesn't use ApiClient.CookieContainer and doesn't provide it to the RestClient, while ApiClient.Exec does.
Example 1:
Running await API.Authentication.GetCurrentUserWithHttpInfoAsync() works fine (doesn't need auth cookies for a first-time login, instead it provides a Set-Cookie header with the Auth cookie). (Side-note, unrelated to this issue: the received data isn't parsed correctly in this case, as the schema doesn't match the "TOTP required" response JSON: { "requiresTwoFactorAuth": [ "totp", "otp" ] } . The endpoint call itself doesn't fail on Auth cookies missing though.)
Running await API.Authentication.Verify2FAAsync(new(totp)) afterwards ends with a 401: Missing Credentials. The VRC API details that this happens when the Auth cookie isn't provided. Replicating the same steps manually in Insomnia works correctly, same as executing this call synchronously (via API.Authentication.Verify2FA()).
Example 2:
After successfully logging in (by running Verify2FA synchronously), running await API.Users.GetUserAsync(userId) leads to the same 401: Missing Credentials error as before.