public function JwtAuth::generateToken in JSON Web Token Authentication (JWT) 8.0
Same name and namespace in other branches
- 8 src/Authentication/Provider/JwtAuth.php \Drupal\jwt\Authentication\Provider\JwtAuth::generateToken()
Generate a new JWT token calling all event handlers.
Return value
string|bool The encoded JWT token. False if there is a problem encoding.
File
- src/Authentication/ Provider/ JwtAuth.php, line 98 
Class
- JwtAuth
- JWT Authentication Provider.
Namespace
Drupal\jwt\Authentication\ProviderCode
public function generateToken() {
  $event = new JwtAuthGenerateEvent(new JsonWebToken());
  $this->eventDispatcher
    ->dispatch(JwtAuthEvents::GENERATE, $event);
  $jwt = $event
    ->getToken();
  return $this->transcoder
    ->encode($jwt);
}