I’ve not had to face this until we implemented an OAuth2 AuthZ Server using SS, and have discovered that we may need to support nicer looking HTML pages when raising exceptions from our services.
It is a common scenario in OAuth2 for a service (i.e. Zapier) to connect to our OAuth2 AuthZ Server and execute the ‘Authorization Flow’, which involves the AuthZ server serving a bunch of HTML pages to login the user and grant them Authorization. Zapier shows these pages to a human being who navigates them.
So we use Razor to serve the standard HTML pages, and everything is fine (as long as there are no exceptions from validation or other things).
However, if an exception is raised (like a validation error) the caller is expecting a text/html
response (not a JSON one).
So Zapier shows us a page like this:
I would be good, for just a limited set of service operations, provide a nicer looking HTML rendering of validation errors like this.
How would you go about doing that?