You are here

function nodejs_auth_get_token in Node.js integration 8

Same name and namespace in other branches
  1. 7 nodejs.module \nodejs_auth_get_token()

Get an auth token for the current user.

1 call to nodejs_auth_get_token()
nodejs_js_settings_alter in ./nodejs.module
Implements hook_js_settings_alter().

File

./nodejs.module, line 525

Code

function nodejs_auth_get_token(SessionInterface $session) {
  $nodejs_auth_get_token_callback = \Drupal::config('nodejs.config')
    ->get('auth_get_token_callback');
  if (!function_exists($nodejs_auth_get_token_callback)) {
    throw new Exception("Cannot proceed without a valid nodejs_auth_get_token callback - looked for '{$nodejs_auth_get_token_callback}'.");
  }
  return $nodejs_auth_get_token_callback($session);
}