You are here

public function Services::csrfToken in Services 9.0.x

Same name and namespace in other branches
  1. 8.4 src/Controller/Services.php \Drupal\services\Controller\Services::csrfToken()

Generate a CSRF session token.

Return value

\Symfony\Component\HttpFoundation\Response. A HTTP response object.

1 string reference to 'Services::csrfToken'
services.routing.yml in ./services.routing.yml
services.routing.yml

File

src/Controller/Services.php, line 105

Class

Services
Class \Drupal\services\Controller\Services.

Namespace

Drupal\services\Controller

Code

public function csrfToken() {
  return new Response(\Drupal::csrfToken()
    ->get('services'), 200, [
    'Content-Type' => 'text/plain',
  ]);
}