feat: add guest auth (device create-or-resume + upgrade)#21
Merged
Conversation
This was referenced Jul 14, 2026
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.
Adds anonymous guest auth to the Unity SDK, mirroring the existing auth methods in
AsobiAuth.What
GuestAsync(string deviceId, string deviceSecret)->POST /api/v1/auth/guest(no auth header). Create-or-resume a guest from a device id + caller-supplied device secret (base64 of >= 32 CSPRNG bytes). Stores tokens exactly likeLoginAsync/OAuthAsync.UpgradeGuestAsync(string username, string password)->POST /api/v1/auth/guest/upgrade(Bearer, current access token). Claims a permanent account; replaces the stored token pair with the upgraded one.GuestRequest(device_id,device_secret) andGuestUpgradeRequest(username,password).AuthResponsegainscreated,guest,upgradedflags (absent -> false for register/login) so callers can inspect create-vs-resume-vs-upgrade. Return type staysTask<AuthResponse>.HttpClientraisesAsobiExceptioncarrying the backend{"error":"<code>"}and HTTP status, same as every other auth call, so all documented guest/upgrade error codes surface through the existing path.Scope note
The caller owns device-secret generation and persistence; the SDK passes it through and builds no secret-gen/storage helpers.
Tests + docs
Tests/Runtime/AuthGuestTests.cs(EditMode): pins the JSON wire contract - request field names and response flag mapping (create / resume / upgrade). The endpoints are exercised end-to-end against a live backend by the existingSmokeTest.Local validation
Unity/IL2CPP can't build headless in this environment.
Runtime/Models/AuthModels.cscompiles clean underdotnet(net8.0). The two newAsobiAuthmethods are line-for-line parallel toLoginAsync. CI validates the full Unity build + PlayMode smoke.