diff --git a/sharethis.module b/sharethis.module
index 1811ed3..f45e64a 100644
--- a/sharethis.module
+++ b/sharethis.module
@@ -93,8 +93,9 @@ function sharethis_node_view(array &$build, EntityInterface $node, EntityViewDis
   // First get all of the options for the sharethis widget from the database:
   $data_options = $sharethis_manager->getOptions();
 
-  // Get the full path to insert into the Share Buttons.
-  $path = $node->toUrl()->setAbsolute()->toString();
+  // Method toUrl in Node object has been deprecated in D8. Used request object
+  // getRequestUri method instead.
+  $path = \Drupal::request()->getRequestUri();
   $title = $node->getTitle();
   // Check where we want to display the ShareThis widget.
   switch ($sharethis_settings->get('location')) {
