Base solution for your next web application
Open Closed

Integrating AspNet.Security.OAuth.Providers #2761


User avatar
0
gijswijs created

Hey,

I wanted to integrate some of the oAuth providers out of the this library: <a class="postlink" href="https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers">https://github.com/aspnet-contrib/AspNe ... .Providers</a>

I'm using the Asp.Net Core 1.x with Angular 2, and I'm trying to hook it up to Web.Core.

I think I have to remove pretty much all of the authentication part (TokenAuthControler.cs, TokenAuth/Models, etc.) am I right?

Could someone give some pointers? Any help is appreciated.


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Sorry for my late response, I thought I have answered your question at the weekend bur probably I was thinking to answer but didn't.

    Anway, As I checked the <a class="postlink" href="https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers">https://github.com/aspnet-contrib/AspNe ... .Providers</a> it seems like it is related to social logins. So in this case, you need to delete the parts related to social logins.

  • User Avatar
    0
    gijswijs created

    Hi ismcagdas,

    Thank you for the reply. I have an error and observation that I want to share with you.

    Error: If I post to /api/TokenAuth/ExternalAuthenticate it returns an error.

    Exception thrown: 'System.IO.FileLoadException' in System.Net.Http.dll
    Exception thrown: 'System.IO.FileLoadException' in mscorlib.dll
    Exception thrown: 'System.IO.FileLoadException' in mscorlib.dll
    

    Observation: You need to post an provideraccescode and a providerkey to this endpoint. To do this for e.g. Facebook in the Angular UI, the Facebook Connect Javascript SDK is loaded, which is (among other things) a oAuth client. So we now have a complete oAuth implementation on the Angular client side and a complete oAuth implementation on the Server side, handling over authentication through /api/TokenAuth/ExternalAuthenticate endpoint. In a way this feels redundant, but I wouldn't know a better approach. Is my abservation correct?

  • User Avatar
    0
    gijswijs created

    Extra info, there are some build conflicts, (although the solution does build)

    There was a conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes".
    1>        "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" was chosen because it was primary and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes" was not.
    1>        References which depend on "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" [C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\mscorlib.dll].
    

    Is this a 4.5.1, 4.6.1 .net framework thing?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Yes your approach is correct, we did the same thin for AspNet Zero. But I couldn't understand the reason for mscorlib.dll error. Project must be 4.6.1.

    Have you searched this problem on the internet ?

    Thanks.