P3.1: Add /auth/token endpoint (password grant proxy) #6

Closed
opened 2026-09-08 04:40:45 +00:00 by rock · 1 comment
Owner

Summary

Gateway exposes POST /auth/token accepting username+password, exchanges with Authentik via grant_type=password, returns JWT + refresh token.

Code repo: rock/homelab-frontend — internal/proxy/auth_endpoints.go

Blocker (2026-09-08)

Password grant on api-gw provider returns invalid_grant for user rock despite:

  • Password reset and verified correct
  • rock added to api-gw-users group
  • Headless auth flow bound (identification → password → login)
  • password in grant_types

Authentik events show login_failed at default-authentication-password stage. Suspected: the default password stage may require additional config for headless/ROPC flow vs browser flow.

client_credentials works for all service accounts. Only human user password grant is broken.

Acceptance Criteria

  • POST /auth/token accepts {"username":"...","password":"...","scope":"..."}
  • Proxies to Authentik token endpoint with grant_type=password
  • Returns JWT + refresh token
  • Unit tests

Depends on

  • P3.2 ✅ (done)
  • P3.7 (config wiring)
  • Password grant debugging (blocker)
## Summary Gateway exposes `POST /auth/token` accepting username+password, exchanges with Authentik via `grant_type=password`, returns JWT + refresh token. **Code repo:** `rock/homelab-frontend` — `internal/proxy/auth_endpoints.go` ## Blocker (2026-09-08) Password grant on `api-gw` provider returns `invalid_grant` for user `rock` despite: - Password reset and verified correct - `rock` added to `api-gw-users` group - Headless auth flow bound (identification → password → login) - `password` in grant_types Authentik events show `login_failed` at `default-authentication-password` stage. Suspected: the default password stage may require additional config for headless/ROPC flow vs browser flow. **client_credentials works** for all service accounts. Only human user password grant is broken. ## Acceptance Criteria - [ ] `POST /auth/token` accepts `{"username":"...","password":"...","scope":"..."}` - [ ] Proxies to Authentik token endpoint with `grant_type=password` - [ ] Returns JWT + refresh token - [ ] Unit tests ## Depends on - P3.2 ✅ (done) - P3.7 (config wiring) - Password grant debugging (blocker)
rock added this to the Phase 3: OAuth2 Token Exchange & Identity Propagation milestone 2026-09-08 04:40:45 +00:00
rock added the status/todoarea/autharea/gatewaypriority/hightype/feature labels 2026-09-08 04:40:46 +00:00
rock self-assigned this 2026-09-08 04:40:47 +00:00
rock added this to the API-GW OAuth project 2026-09-08 04:43:44 +00:00
rock closed this issue 2026-09-09 00:00:47 +00:00
Author
Owner

Closed by homelab-frontend PR #18: riotpiao-poimen/homelab-frontend#18

Closed by homelab-frontend PR #18: https://forgejo.riotpiao.com/riotpiao-poimen/homelab-frontend/pulls/18
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: riotpiao-poimen/homelab#6