You are here

public static function Webhook::verifyToken in Webhooks 8

Verify the webhook with the stored token.

Parameters

string $token: The webhook token.

string $token_received: The webhook token from the headers.

Return value

bool Boolean TRUE for success.

Throws

\Drupal\webhooks\Exception\WebhookMismatchTokenException Throws exception if signatures do not match.

1 call to Webhook::verifyToken()
WebhooksService::receive in src/WebhooksService.php
Receive a webhook.

File

src/Webhook.php, line 428

Class

Webhook
Class Webhook .

Namespace

Drupal\webhooks

Code

public static function verifyToken($token, $token_received) {
  if ($token !== $token_received) {
    throw new WebhookMismatchTokenException($token, $token_received);
  }
  return TRUE;
}