Panel saving files error

Hello,
I am almost ready with my first Kirby website. But I got stuck with an erros when I publish it on a Linux server.

I edited the blueprints/file/default.yml to be able to add a CAption and a ALT text to the images. The default.yml file looks like this:

title: Image
options:
  update:
    admin: true
    editor: true
columns:
  - width: 1/2
    sections:
      content:
        type: fields
        fields:
          caption:
            label: Caption
            type: textarea
            size: medium
  - width: 1/2
    sections:
      meta:
        type: fields
        fields:
          alt:
            label: Alternative Text
            type: text

On local Windows server is working fine. But when Igo to the Linux server and try to change a ALT text it gives me an error:
The form could not be saved
Exception: undefined

  • The JSON response from the API could not be parsed. Please check your API connection.*
    If I have a look art the JSON response looks like:
status “error”
route “(.*)/files/([a-zA-Z0-9\.\-_%= \+\@\(\)]+)”
exception “Kirby\Exception\PermissionException”
message “Unauthenticated”
key “error.permission”
file “concomitentes/kirby/config/api/authentication.php”
line 12
details []
code 403

Any clue what could be happening?

Thanks

Jorge

Have you tried to clear your /site/sessions folder and cleared the browser cache? This seems to be a problem with the session token.

Can you edit pages? Does this only happen when editing the alt field? I guess you get the same error when editing the caption field.

Thanks for your replay.
I have tried to clear de sessions , cache and cookies. It is not working. I can edit all the pages and add pages wihtout any problem , it is just when I tried to modify ALT or caption on images.

What if you remove the options from the blueprint?

I tried, not working. I actually made the blueprint very simple:

title: Image
fields:
alttext:
label: Alternative Text
type: text
width: 1/2

But stil not working. I can rename the file and add files. But I cannot delete them, I get the same error.

Hm, I look into this later.

Let’s give you an update. Still not working, I have tried deleteing the sessions again and trying on a new browser, and it didn’t help. I have been playing with the file
/kirby/config/api/authentification.php

// csrf token check
if ($auth->type() === ‘session’ && $auth->csrf() === false) {
throw new PermissionException(‘Unauthenticated’, 403);
}

I checked thath $auth->type() is “session” and when I try to send in the response $auth->csrf() it is empty, should it have a value?? it doesn’t print “false” neither.

Hm, this is weird. The token is used for everything and I have no clue at all while it should stop working for file metadata but not other stuff.

Could you test and deploy a completely fresh Starterkit on that same server, and try to add some data to a file. To be able to create a Panel account on the remote server, you have to add

  'panel' =>[
    'install' => true
  ]

to the /site/config/config.php's return statement.