title: Adding External Authentication in ASP.NET MVC
body: <p>I am trying to add external authentication using Google to an MVC webapp</p>
  
  <p>I get all required information from Google, and after saving my appUser to DB, I am doing this:</p>
  
  <pre><code>var info = await AuthenticationManager.GetExternalLoginInfoAsync();
  if (info == null)
  {
      return View("ExternalLoginFailure");
  }
  
  // Password is a required field, although not actually needed here
  model.Password = Guid.NewGuid().ToString();
  
  AppUser user = await _profileService.CreateUserProfile(model, UserManager, true);
  
  if (user != null)
  {
      var result = await UserManager.AddLoginAsync(user.Id, info.Login);
      if (result.Succeeded)
      {
          await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
          return RedirectToLocal(returnUrl);
      }
      AddErrors(result);
  }
  </code></pre>
  
  <p>And in SignInManager.SignInAsync I am getting an exception </p>
  
  <blockquote>
    <p>Sequence Contains More than 1 element</p>
  </blockquote>
  
  <p>Stack trace is not very informative:</p>
  
  <pre><code>--- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
     at Microsoft.AspNet.Identity.TaskExtensions.CultureAwaiter`1.GetResult()
     at Microsoft.AspNet.Identity.Owin.SignInManager`2.&lt;ExternalSignInAsync&gt;d__1d.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
     at AccountController.&lt;ExternalLoginCallback&gt;d__31.MoveNext() 
  </code></pre>
  
  <p>I am a bit stuck here, no idea how to get more information and where to look.</p>