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:
@@ -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)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user