当我将401返回给客户端时,Chrome会在进入Interceptor的responseError处理程序之前立即打开Credentials Dialog。如何使用自定义登录表单?我可以取消浏览器登录提示吗?这是我的拦截器:
.service('APIInterceptor', function ($q, $rootScope, $location) {
var service = this;
service.request = function(config) {
access_token = currentUser ? currentUser.access_token : null;
if (access_token) {
config.headers.authorization = access_token;
}
return config;
};
service.responseError = function (rejection) {
if (rejection.status === 401) {
$location.path('/login');
}
return rejection;
};
})
这是我的C#测试代码:
throw new HttpResponseException(
Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Test Error Message"));
由于