Log out link: Invalid form token. Please reload this form and submit again

I added a Log Out link like this:

<a href="<?= \URL::to('/login', 'do_logout', $app->make(\Concrete\Core\Validation\CSRF\Token::class)->generate('do_logout')) ?>">Log Out</a>

I am certain it used to work, but now it doesn’t log the user out. It resolves to this url: /login/do_logout/1725895001%3A3d68205047bef10114529144935bda1b

The user sees a white screen with the message:
“Invalid form token. Please reload this form and submit again.”

I’m by no means am I an expert here on the ever changing code base but changing “$app->make” to “Core::make” works fine in v9

working as expected here

Core::make is deprecated and is slowly being removed from the core.

Depending on where you are, $app may need to be set up with Application::getFacadeApplication();

In a controller, it may exist as $this->app.

Wherever you are, there is a magic method app(). So app()->make(…) will do the same.

The original invalid token issue could arise from a cached page.

Tokens have a short life. If a page or block is cached, the token could be older than its validity period.

Looking at my current logout link from the marketplace, the URL is https://market.concretecms.com/login/do_logout/1redacted8%3redacted2, so the generated logout URL follows the right form.