Skip to content

[Docs] backend/docs/AUTHENTICATION.md documents an outdated, replay-prone signed-XDR-as-Bearer model instead of the implemented nonce challenge/verify + JWT flow #820

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

auth.ts requires /v1/auth/verify to submit a tx whose manageData value equals the server-issued nonce, then issues a JWT used as the Bearer token. But docs/AUTHENTICATION.md:84-104 tells clients to put their own random crypto.randomBytes(32) in manageData and send the raw signed XDR as Authorization: Bearer <signed_transaction> - the pre-nonce model that is replay-prone. It also recommends optionalAuthMiddleware (dead code) and stale error strings. A client following this doc cannot authenticate.

Acceptance criteria

  • Rewrite AUTHENTICATION.md to describe the real flow: POST /v1/auth/challenge -> server nonce -> POST /v1/auth/verify with XDR containing that nonce -> JWT -> Bearer JWT
  • Show building the manageData op with the server-returned nonce, not a client-random value
  • Correct the error-response examples and remove the dead optionalAuthMiddleware recommendation

Files to touch

  • backend/docs/AUTHENTICATION.md
  • backend/src/middleware/auth.ts

Out of scope

  • Changing the auth implementation itself

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programdocsDocumentationdocumentationDocumentation tasks

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions