title: Authenticate User in Symfony 3 without Database
body: <p>I have an application where the login process runs against an external API. The API gives me a JSON back which I store in my User Enitiy.(Call it Member)</p>
  
  <p>The User Class implements <strong><em>AdvancedUserInterface</em></strong>. </p>
  
  <p>And my Login Prozess.</p>
  
  <pre><code>    $firewall = 'main';
      $token = new UsernamePasswordToken($member, null, $firewall, $member-&gt;getRoles());
      $this-&gt;tokenStorage-&gt;setToken($token);
      $this-&gt;session-&gt;set('_security_'.$firewall, serialize($token));
  
      $request = new \Symfony\Component\HttpFoundation\Request();
  
      $event = new InteractiveLoginEvent($request, $token);
      $this-&gt;eventDispatcher-&gt;dispatch("security.interactive_login", $event);
  </code></pre>
  
  <p>But that dosen't work. Now i'm read <a href="https://ourcodeworld.com/articles/read/459/how-to-authenticate-login-manually-an-user-in-a-controller-with-or-without-fosuserbundle-on-symfony-3" rel="nofollow noreferrer">here</a> That this Prozess need users in a Database. My application dosen't have a User DB. Is there a way to Login the User without it. </p>