haskell-servant / haskell-servant/servant
AuthHandler to result in a 302 or 401 depending on whether the request is an AJAX call
Open
question
- Dominant language
- Haskell
- Stars
- 2k
- Forks
- 427
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 5
Description
In our app certain auth-protected endpoints render the HTML directly, in which cases a 302 redirect to `/signin` works well if the user is not authenticated.
However, in the case of AJAX calls, we'd rather respond with a 401 to prevent the XmlHttpRequest object in the browser from transparently loading the HTML of the signing page on an unauthenticated AJAX request.
How do we set such an AuthHandler up?
/cc #826
Contributor guide
Assessment
This issue has not been assessed yet.