title: How do I get a token (bearer) to run queries and where do I store it?
body: <p>How do I get a token (bearer) to run queries and where do I store it?</p>
  <p>If I use <code>createToken('token')-&gt;plainTextToken</code>, I need to store it somewhere.</p>
  <p>It is needed to send requests to the API connected as a separate package in the application with its routes.</p>
  <p>The only workable solution was this:</p>
  <pre><code>Http::macro('test', function () {
      return Http::withHeaders([
          'Accept' =&gt; 'application/vnd.api+json',
          'Content-Type' =&gt; 'application/vnd.api+json',
      ])-&gt;withToken(Auth::user()-&gt;createToken('token')-&gt;plainTextToken);
  });
  </code></pre>
  <p>But I understand that generating a token for every request is weird at the very least, so I'm looking for the right solution.</p>
  <p>As I understand it needs to be generated at login and somehow saved.</p>
  <p>I use Laravel JetStream (InertiaJS).</p>
  <p>P.S: Example request from the controller</p>
  <pre><code>$laboratory = Http::test()-&gt;get(config('app.url') . $this-&gt;api_path . '/laboratories/' . $id);
  
  return Inertia::render('Laboratories/Show', ['laboratory' =&gt; $laboratory['data']]);
  </code></pre>