title: How to generate JWT refresh token in Laravel 5.7
body: <p>First off, let me admit that I'm new to APIs, and right now I'm working on JWT with Laravel. I'm using tymon\jwt-auth (<code>tymon/jwt-auth:dev-develop --prefer-source</code> to be specific). I went through some tutorials and was able to generate JWT access token.</p>
  
  <p>Here is my login code:</p>
  
  <pre><code>public function login() {
      $credentials = request(['email', 'password']);
      if (!$token = auth('api')-&gt;attempt($credentials)) {
          return response()-&gt;json(['error' =&gt; 'Unauthorized'], 401);
      }
      return response()-&gt;json([
          'status' =&gt; 'success',
          'message' =&gt; 'Login successful',
          'data' =&gt; [
            'access_token' =&gt; $token,
          ],
      ]);
  }
  </code></pre>
  
  <p>I also need to get refresh token along with the access token, and cannot find code that works in my case.</p>
  
  <p>I tried adding these lines in the code:</p>
  
  <pre><code>$refresh_token = JWTAuth::refresh($token);
  </code></pre>
  
  <p>but the postman returns with this error:</p>
  
  <blockquote>
    <p>A token is required in file
    /var/www/brochill-api/vendor/tymon/jwt-auth/src/JWT.php on line 331</p>
  </blockquote>
  
  <p>I can also provide other configuration snippets I used if needed. Please help!</p>