Update field value in virtual page

Hi all. If I create a page using the config file like…

  'routes' => [
    [
      'pattern' => '/cc/authorize',
      'action'  => function () {
        return new Page([
          'slug' => 'authorize',
          'template' => 'cc-authorize',
          'content' => [
            'title' => 'Authorize',
            'refresh_token' => 'blamp123'
          ]
        ]);
      },
      'method' => 'GET|POST'
    ]
  ],

… can I later update say the refresh_token field? The following doesn’t seem to work.

$kirby->impersonate('kirby');
$newPage = page('cc/authorize')->update([
  'refresh_token' => 'something'
]);

Please advise.

No, you cannot update this “page”. What is your use case? You could pass the data via URL, though.

Hi @texnixe,

Thanks for the quick reply and confirmation. I kinda figured that was the case.

I’m implementing an OAuth setup and I need some place to store token values. I can stuff 'em under $site or perhaps just create a traditional page and keep all this related data and logic together.

Thanks again! I hope all is well.