I have a dancer web application that is part web-site and part web-service; certain routes on my application should have auth on them.
All the auth solutions I've found for a Dancer web app require the redirection to a login page; while this is okay for interactive use, this isn't optimal for a restful web service.
Is there an auth solution that would allow for something like api keys?
You should have look at Dancer::Plugin::Auth::Extensible to build this. The most simple way it to send credentials in each request. On the client, you'd be calling your REST service like this:
$ua->post('http://example.com/rest/getStuff?cred=foobar1234567, $search_criteria);
If you do it like this, you could provide a cookie, but you do not have to, and the customer would not necessarily need to care about the cookie.
Edit: If you want Basic Authentication, take a look at Plack::Builder. You can use it to add the auth to certain requests.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With