Skip to content

fix(auth): stop calling a missing wallet an invalid token - #604

Merged
dadiorchen merged 1 commit into
Greenstand:keycloakfrom
samwel141:fix-no-wallet-signal-891-again
Sep 29, 2026
Merged

dadiorchen merged 1 commit into
Greenstand:keycloakfrom
samwel141:fix-no-wallet-signal-891-again

Conversation

@samwel141

Copy link
Copy Markdown
Collaborator

Closes Greenstand/treetracker-wallet-app#891

Problem

An account can be signed in and have no wallet. The token verifies, the wallet
lookup finds nothing, and every endpoint except POST /wallets answered
401 "invalid token received", telling a valid user their login was broken.

Change

It answers 409 with reason: no_wallet, so a client can tell "make a wallet
first" from "sign in again". 401 stays for a token that is genuinely bad or
expired.

This re-applies #580, which the rollback in #593 reverted. The app side that
reads the reason is already merged.

Verification

  • Unit 243, integration 111, repository 30, eslint clean.
  • no-wallet-account.spec.js covers GET /wallets and redeeming a share link
    with a verified token and no wallet, both 409 with the reason.

An account can be signed in and have no wallet. The token verifies, the
wallet lookup finds nothing, and every endpoint except POST /wallets
answered 401 "invalid token received", telling a valid user their login
was broken.

It now answers 409 with reason no_wallet, so a client can tell "make a
wallet first" from "sign in again". 401 stays for a token that is
genuinely bad or expired.

This re-applies Greenstand#580, which the rollback in Greenstand#593 reverted. The app side
that reads the reason is already merged.

Closes Greenstand/treetracker-wallet-app#891
@dadiorchen
dadiorchen merged commit 887bb42 into Greenstand:keycloak Sep 29, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.44.0-keycloak.39 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@dadiorchen

Copy link
Copy Markdown
Collaborator

@mahdi2ba please test it

@mahdi2ba

mahdi2ba commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

@dadiorchen Retested on dev
Created the wallet, the shared token is in it. No more "invalid token" message.

Test OK , Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants