public async Task Invoke(HttpContext context) {
            try {
                await this.next.Invoke(context);
            } catch (Exception e) {
                if (e.Message == "No authentication handler is configured to handle the scheme: Automatic") {
                    ApiResult authResult = new ApiResult() {
                        Result = new AuthorizeException()
                    };

                    if (Startup.ExceptionHttpStatusCode) {
                        context.Response.StatusCode = 403;
                    }else {
                        context.Response.StatusCode = 200;
                    }
                    context.Response.ContentType = "application/json";
                    await context.Response.WriteAsync(authResult.ToString());
                }
            }
        }