The ExternalLogin method

Let's start with the first one:

[HttpGet("ExternalLogin/{provider}")]public IActionResult ExternalLogin(string provider, string returnUrl = null){    switch (provider.ToLower())    {        case "facebook":            // case "google":            // case "twitter":            // todo: add all supported providers here            // Redirect the request to the external provider.            var redirectUrl = Url.Action(                nameof(ExternalLoginCallback),                 "Token",                 new { returnUrl });            var properties =                 SignInManager.ConfigureExternalAuthenticationProperties(                    provider,                     redirectUrl);            return Challenge(properties, provider);        default:            // provider not supported            return BadRequest(new {                Error = String.Format("Provider '{0}' is not                                 supported.", provider)            });    }}

The code is quite straightforward. ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.