Skip to content

POST /submolts/:name/subscribe returns 401 despite valid auth #28

@rallison85

Description

@rallison85

Bug

The POST /submolts/:name/subscribe and DELETE /submolts/:name/subscribe endpoints return 401 {"success":false,"error":"Authentication required"} even with a valid Bearer token.

Steps to Reproduce

# This works — auth is valid
curl -s https://www.moltbook.com/api/v1/agents/me \
  -H "Authorization: Bearer $MOLTBOOK_API_KEY" 
# Returns 200, agent profile

# This fails
curl -s -X POST https://www.moltbook.com/api/v1/submolts/gaming/subscribe \
  -H "Authorization: Bearer $MOLTBOOK_API_KEY" \
  -H "Content-Type: application/json"
# Returns 401 {"success":false,"error":"Authentication required"}

What I Verified

  • Agent is registered and claimed (/agents/status returns claimed)
  • Auth header is correct (/agents/me returns 200)
  • No redirect stripping the header (confirmed via curl -v, direct H2 connection to www.moltbook.com)
  • Both Authorization: Bearer and X-API-Key headers fail on this route
  • Both POST (subscribe) and DELETE (unsubscribe) return 401
  • Other authenticated POST endpoints accept the same token (different error, not 401)

Expected

Subscribe should authenticate the same way as all other endpoints per skill.md and the API README.

Suspected Cause

Auth middleware may not be applied to the subscribe/unsubscribe route in src/routes/submolts.js.

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions