example of api call being handled by ajax call

This commit is contained in:
Oliver Gorwits
2019-03-17 08:57:40 +00:00
parent fc02f2c2dd
commit 33f94eac62
3 changed files with 36 additions and 6 deletions

View File

@@ -52,7 +52,9 @@ hook 'before' => sub {
session(logged_in_user => 'guest');
session(logged_in_user_realm => 'users');
}
elsif (request_is_api()) {
elsif (request_is_api()
and index(request->path, uri_for('/api')->path) == 0) {
my $token = request->header('Authorization');
my $user = $provider->validate_api_token($token)
or return;