diff --git a/src/Auth.php b/src/Auth.php index 0e368b8..eb69f9f 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -248,4 +248,18 @@ public function updateUser(string $bearerUserToken, string $email = null, string return $this->service->executeHttpRequest('PUT', $uri, $options); } -} \ No newline at end of file + /** + * Delete the user, need service_role secret + * @param $id String The user id + * @return array|object|null + */ + public function deleteUser($id) + { + $uri = $this->service->getUriBase($this->suffix . 'admin/users/' . $id); + $options = [ + 'headers' => $this->service->getHeaders() + ]; + return $this->service->executeHttpRequest('DELETE', $uri, $options); + } + +} diff --git a/src/Service.php b/src/Service.php index e3d1950..c735d7e 100644 --- a/src/Service.php +++ b/src/Service.php @@ -29,6 +29,7 @@ public function __construct(string $apiKey, string $uriBase) $this->httpClient = new \GuzzleHttp\Client(); $this->headers['apikey'] = $this->apiKey; + $this->headers['Authorization'] = 'Bearer ' . $this->apiKey; } /** @@ -221,4 +222,4 @@ public function executeHttpRequest(string $method, string $uri, array $options) throw $e; } } -} \ No newline at end of file +}