-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hey. First of all I dig the gem, loving how simple it is. Not sure if it was intended for my type of use though. I'm building an API which requires authentication for certain requests, but a simple redirect to '/whatever_route' isn't quite what one would expect when developing against an API and authentication fails.
Maybe I'm just lacking the necessary Sinatra skills (yes I am new at this), but something like
def authentication_required
status 403
{"error" => "Authentication required."}.to_json
end
set :session_fail, lambda { authentication_required }would be awesome. Of course the "authentication_required" method fails here as it doesn't have the status method. Any way to accomplish this? Would love to send a PR with documentation if you can help me figure this out. Cheers! :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels