Skip to content

Instantly share code, notes, and snippets.

@achraf-jeday
Last active June 25, 2019 15:54
Show Gist options
  • Save achraf-jeday/26b8a74df18b499e09f2c406eac6873c to your computer and use it in GitHub Desktop.
Save achraf-jeday/26b8a74df18b499e09f2c406eac6873c to your computer and use it in GitHub Desktop.
Drupal 8 and GuzzleHttp 6: Basic HTTP authentication.
$credentials = base64_encode("admin:SuperSecret123");
$apiResponse = $this->client->get("{$this->container->getParameter('api')}jwt/token",
[
'verify' => false,
'headers' => [
'Authorization' => 'Basic ' . $credentials,
],
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment