title: Call AccessTokenController.issueToken() directly from Code
body: <p>I am using Laravel Passport to secure my REST API. Currently I create Personal Access Tokens using <code>$user-&gt;createToken('APP_NAME')-&gt;accessToken</code>, but these have no expiration date. So I wanted to create a Password Access Token. I noticed, that these are generated by the <code>AccessTokenController.issueToken()</code> method.</p>
  
  <p>But I could not find anything on how I can call it.</p>
  
  <hr>
  
  <p><strong>My current solution</strong></p>
  
  <pre><code>$input = $request-&gt;all();
  
  $user = User::where('email', $input['email'])-&gt;first();
  
  if ($user) {
      if ($input['password'] == $user-&gt;password) {
          $token = $user-&gt;createToken($this-&gt;app_name)-&gt;accessToken;
          return [
              'token' =&gt; $token,
              'user' =&gt; $user
          ];
      } else
          return new ResponseGeneratorError('Password mismatch', 400);
  } else
      return new ResponseGeneratorError('User does not exist', 400);
  </code></pre>