Skip to content

fix(server-sdk): throw on failed auth requests instead of returning the error body - #2278

Merged
albertoelias-crossmint merged 5 commits into
mainfrom
albertoe/server-auth-getuser-errors
Nov 6, 2026
Merged

albertoelias-crossmint merged 5 commits into
mainfrom
albertoe/server-auth-getuser-errors

Conversation

@albertoelias-crossmint

@albertoelias-crossmint albertoelias-crossmint commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

No description provided.

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-bot

changeset-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca2ba3d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@crossmint/server-sdk Patch
@crossmint/common-sdk-auth Patch
@crossmint/auth-ssr-nextjs-demo Patch
crossmint-auth-node Patch
@crossmint/client-sdk-auth Patch
@crossmint/client-sdk-react-base Patch
@crossmint/client-sdk-react-native-ui Patch
@crossmint/client-sdk-react-ui Patch
@crossmint/wallets-sdk Patch
@crossmint/wallets-playground-expo Patch
@crossmint/client-sdk-nextjs-starter Patch
@crossmint/wallets-quickstart-devkit Patch
@crossmint/wallets-playground-react Patch
@crossmint/integration-tests Patch

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

devin-ai-integration[bot]

This comment was marked as resolved.

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[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

greptile-apps[bot]

This comment was marked as resolved.

@albertoelias-crossmint

Copy link
Copy Markdown
Collaborator Author

@greptileai review

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>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

@albertoelias-crossmint
albertoelias-crossmint enabled auto-merge (squash) November 6, 2026 19:41
@albertoelias-crossmint
albertoelias-crossmint merged commit e6ad150 into main Nov 6, 2026
9 checks passed
@albertoelias-crossmint
albertoelias-crossmint deleted the albertoe/server-auth-getuser-errors branch November 6, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants