Headless Authentication

Just playing around and trying to get the KQL to output data but I’m just getting this at the moment:

{
  "status": "error",
  "message": "Unauthenticated",
  "code": 403,
  "exception": "Kirby\\Exception\\PermissionException",
  "key": "error.permission",
  "file": "authentication.php",
  "line": 11,
  "details": [],
  "route": "query"
}

I have added the following to my config.php

<?php

return [
    'debug'  => true,
    'api' => [
        'basicAuth' => true
    ]
];

Any quick pointers where I’m going wrong?

Do you actuall send an authorization header with credentials with your request?

Have you created a custom user for authentication ?

How do you fetch your data ? from PHP, JS ?

Could you share your code ?

You can also use a tool like Insomnia to test queiries and mess around with the data:

If your working locally, you may need to add the add insecure option to the config to work with it on your maching (do not do that on a live public server!)

Insomnia :+1:

for localhost like jim said

site/config/config.localhost.php

return [
  'api' => [
    'basicAuth' => true,
    'allowInsecure' => true, // localhost without https
  ]
];