Centralizing Auth Tokens and Error Handling with AngularJS $http Interceptors
AngularJS $http interceptors let you attach auth tokens and handle 401s in one place — if you scope them with an URL allowlist and propagate rejections correctly. Here's a worked example with tests.