How to achieve social authentication using only some of the features of ASP.NET Core Identity

  • Thread starter Thread starter TrailRunner-MF
  • Start date Start date
T

TrailRunner-MF

Guest
1. What I want to know.

I am trying to plug-in external authentication function into a ASP.NET Core web application that was originally created without Identity, but it does not work well. I would like to know how to achieve this.

2.Background

I am trying to embed social login functionality into an authentication system created using WebForm in ASP.NET 4.0.In order to achieve this, I have created a separate Web Service in ASP.NET Core, and made a call from the ated by WebForm authentication system.

To realize this requirement, I created a web application in ASP.NET Core that uses Identity, and copied a part of the razor page program created by Scafolding to accept the Post instruction from the outside. The target razor page is ExternalLogins.cshtml and its cs sourc in the /Area/Pages/Identiy/manager folder. I've tried it and it works as I intended.

So next, I created a plain ASP.NET Core web application without Identity and later tried to achieve the external authentication functionality by adding the Nuget package and modifying the Proguram and Startup class. The reason for this is that I don't need Identity anything other than retrieve external authentication. But in this case, the external authentication does not work well.

3. cause
When using the latter program, the request does not reach the SNS authentication page specified in the external authentication configuration file when performing external authentication. Specifically, the OnPostLinkLoginAsync method in ExternalLogins.cs receives the request correctly, but after the method returns the ChallengeResult, an error occurs on the authentication page on the SNS side and the page transition is interrupted.

4. what I want to know more specifically.
After all, in order to use Identity's external authentication features, do I have to specify that Identity is to be included in the first step of creating a web application?

I thought that if the Nuget Package used by the two web programs was the same and the contents of Proguram.cs and Startup.cs were the same, the behavior of the two programs would be the same, so I'm a little confused by this error.

5. Reference.
A sample program is available on GitHub to test this case study. If you are interested, please refer to the following URL
TrailRunner-MF/Samples
The application ID and Secret information of SNS and the SQL Server connection information used by Identity will need to be rewritten by the user, but it should be easy to implement if you are ready for them. Details of how to set up the program is written in Readme.txt in the "Document" folder.
Please give it a try.

Continue reading...
 
Back
Top