Skip to content

feat(auth): add token-based authentication via Personal Access Token#40

Merged
sunba91-su merged 1 commit into
mainfrom
fix/token-auth
Jun 9, 2026
Merged

feat(auth): add token-based authentication via Personal Access Token#40
sunba91-su merged 1 commit into
mainfrom
fix/token-auth

Conversation

@sunba91-su

Copy link
Copy Markdown
Owner

Summary

Replace password-based authentication with Personal Access Token (PAT) support. This is the definitive fix for all special-character escaping issues in Docker Compose .env files.

Changes

  • config.go: Add BotToken + BotUserID fields; validation accepts token+userID OR password
  • client.go: Connect() accepts token+userID; connect() uses token auth when credentials have ID+Token set (SDK handles both paths transparently)
  • cmd/bot/main.go: Pass new fields to Connect()
  • .env.example + README.md: Document new PAT vars

Testing

  • go build ./... — passes
  • go test -race ./... — passes
  • go vet ./... — passes

Closes #39

Switch from password-only auth to support PAT via ROCKETCHAT_BOT_TOKEN
+ ROCKETCHAT_BOT_USER_ID env vars. The SDK handles both paths: token
sets X-Auth-Id/X-Auth-Token headers directly on REST; password falls
back to SHA-256 digest login via DDP.

Closes #39
@sunba91-su sunba91-su merged commit cbe4bb6 into main Jun 9, 2026
4 checks passed
@sunba91-su sunba91-su deleted the fix/token-auth branch June 9, 2026 03:29
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.

Switch from password to Personal Access Token for bot auth

1 participant