refactor(backend): replace inline Bearer parsing with OptionalAuth middleware in services

Removes the inline Bearer token fallback in ServicesHandler — the OptionalAuth middleware (added to the public services route group in main.go) now handles auth context population. This eliminates duplicated token parsing logic and ensures consistent auth behavior across all routes.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-07-06 19:22:00 +01:00
co-authored by Sisyphus
parent 92124158bf
commit e303c07f8d
2 changed files with 2 additions and 19 deletions
+1
View File
@@ -186,6 +186,7 @@ func main() {
// Public read-only (but check auth context if present for eligibility)
r.Group(func(r chi.Router) {
r.Use(mw.RateLimit(120, time.Minute))
r.Use(mw.OptionalAuth)
r.Get("/services", services.ServicesHandler)
r.Get("/services/eligible-for/{user_id}", services.ServicesEligibleForUserHandler)
})