You are here

public function Webhook::getToken in Webhooks 8

Get the secret token from headers.

Return value

string The token string from the webhook header.

File

src/Webhook.php, line 361

Class

Webhook
Class Webhook .

Namespace

Drupal\webhooks

Code

public function getToken() {
  foreach ($this
    ->getHeaders() as $name => $value) {
    if (preg_match('/X-([a-z0-9]{1,})-Token/i', $name)) {
      return $value;
    }
  }
  return '';
}