In Drupal 7, I was able to use bootstrap.inc in an external PHP script, which was a custom set of pages that simply bootstrapped Drupal to check the user was logged in Drupal.
The following code is a very basic version that just returns the username of an active session.
require_once '../includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
global $user;
echo $user->name;
I'm looking to implement something similar in Drupal 8. The same script returns a server error.
Error: Class 'Drupal\Core\Session\AccountInterface' not found in core/includes/bootstrap.inc, line 63
How should I check for an active user session from an external script, in Drupal 8?