The ExternalLoginCallback method

It's now time to add the second action method--the one that will receive the HTTP redirection from the external provider with the authorization code and act accordingly:

[HttpGet("ExternalLoginCallback")]public async Task<IActionResult> ExternalLoginCallback(    string returnUrl = null, string remoteError = null){    if (!String.IsNullOrEmpty(remoteError))    {        // TODO: handle external provider errors        throw new Exception(String.Format("External Provider error:                                           {0}", remoteError));    }    // Extract the login info obtained from the External Provider    var info = await SignInManager.GetExternalLoginInfoAsync();    if (info == null)    {        // if there's none, emit an error        throw new Exception("ERROR: No login info available.");    }

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.