Php Access User Data from external script Currently my Drupal installation is at www.example.com/wiki/

I was wondering if it is possible in Drupal 8.2.4 to access the current user uid from an external php script.

The script is located at www.example.com/someScript.php

I've tried this before

include_once('./includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

global $user;

if ($user-&gt;uid) {
    print "Logged in";
} else {
   print "Logged out";
}
You can following file authorize.php to do it like this: 

&lt;?php
use Drupal\Core\DrupalKernel;
use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

$autoloader = require_once 'autoload.php';

function authorize_access_allowed(Request $request) {
  $account = \Drupal::service('authentication')-&gt;authenticate($request);
  if ($account) {
    \Drupal::currentUser()-&gt;setAccount($account);
  }
  return Settings::get('allow_authorize_operations', TRUE) &amp;&amp; \Drupal::currentUser()-&gt;hasPermission('administer software updates');
}

try {
  $request = Request::createFromGlobals();
  $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
  $kernel-&gt;prepareLegacyRequest($request);
}
catch (HttpExceptionInterface $e) {
  $response = new Response('', $e-&gt;getStatusCode());
  $response-&gt;prepare($request)-&gt;send();
  exit;
}

authorize_access_allowed($request);
$user = Drupal::currentUser();

if ($user-&gt;id()) {
    print "Logged in";
} else {
   print "Logged out";
}