Repository navigation
fix(server-sdk): throw on failed auth requests instead of returning the error body - #2278
Merged
Merged
Conversation
CrossmintAuth.getUser parsed the response without checking its status, so a 403 for a server key without users.read came back as the "user". It now throws CrossmintAuthenticationError with the HTTP status and the API's message, names the users.read scope on 401/403, and returns SDKExternalUser instead of any. Session refresh and logout also keep the status and API message on failure, and the server SDK exports CrossmintAuthenticationError and SDKExternalUser. The README documents which scopes each method needs.
🦋 Changeset detectedLatest commit: ca2ba3d The changes in this PR will be included in the next version bump. This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
7 of 8 tasks
Contributor
[Medium impact] The PR appears safe to merge; no new actionable issues remain. Reviews (2) · Last reviewed commit: "Kebab-case the auth error test file and ..." · Reviewed by Greptile |
Collaborator
Author
|
@greptileai review |
4 of 5 tasks
The API's 403 already names the missing scope, so the hint repeated it. Other 401/403s (deleted or invalid key, origin not allowed) got a hint pointing at the wrong fix. The error now carries the status and the API's message only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
albertoelias-crossmint
enabled auto-merge (squash)
November 6, 2026 19:41
guilleasz-crossmint
approved these changes
Nov 6, 2026
albertoelias-crossmint
deleted the
albertoe/server-auth-getuser-errors
branch
November 6, 2026 21:05
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.
No description provided.