title: Laravel: How to authenticate users without DB
body: <p>As the title suggests, is it possible to authenticate without DB (instead, using User Provider)?</p>
  
  <p>I've seen posts about <em>how to authenticate without password</em>, but would it be ever possible to authenticate without <em>DB</em>?</p>
  
  <p>Here is what I've been trying to achieve...</p>
  
  <ol>
  <li>Ask the user to submit a PIN</li>
  <li>Compare the PIN with a value within .env</li>
  <li>If the PIN is correct, authenticate the user</li>
  </ol>
  
  <p>It seems to be possible to do authenticate without a traditional RDBMS by <a href="https://laravel.com/docs/5.6/authentication#adding-custom-user-providers" rel="noreferrer">introducing a user provider.</a></p>
  
  <p>However, the doc doesn't seem to describe how the user provider should look like.</p>
  
  <p>Here are snippets of my code (well, I simply mimicked the doc)...</p>
  
  <pre><code>class AuthServiceProvider extends ServiceProvider {
  
      public function boot()
      {
          $this-&gt;registerPolicies();
  
          Auth::provider('myUser', function ($app, array $config) {
              // Return an instance of Illuminate\Contracts\Auth\UserProvider...
  
              return new MyUserProvider($app-&gt;make('myUser'));
          });
      }
  }
  </code></pre>
  
  <p>In <code>auth.php</code>...</p>
  
  <pre><code>'providers' =&gt; [
      'users' =&gt; [
          'driver' =&gt; 'myUser',
      ],
  ],
  </code></pre>
  
  <p>Now, I have no clue as to how to proceed.</p>
  
  <p>So, I'd like to know...</p>
  
  <ol>
  <li><p>How the <code>user provider</code> should look like</p></li>
  <li><p>if it's possible to authenticate users with <code>env()</code> in the first place</p></li>
  </ol>
  
  <p>Any advice will be appreciated.</p>