3

I'm building an AngularJS Single-Page App using the latest VS2015 Community and ASP.NET 5 etc...

The problem I'm now having while trying to implement an Authentication is that I need to use these two Namespaces:

Microsoft.AspNet.Identity //Version 3.0.0-beta4
Microsoft.AspNet.Identity.Owin //Version 2.2.1

but since Microsoft.AspNet.Identity.Owin has a dependency with

Microsoft.AspNet.Identity.Core 

I keep getting ambiguous reference issues, for example for UserManager which exists in both Microsoft.AspNet.Identity and Microsoft.AspNet.Identity.Core .

Has anyone else dealt with this before? Is it a version incompatibility issue or just the not complete Owin ASP.NET 5 implementation?

jimmious
  • 358
  • 3
  • 19

1 Answers1

8

The Microsoft.AspNet.Identity.Owin package is part of ASP.NET Identity 2, not the newest version shipped with ASP.NET 5. Trying to reference it will download ASP.NET Identity 2 and cause the weird error you're experiencing.

Just reference Microsoft.AspNet.Identity and it should work.

Kévin Chalet
  • 39,509
  • 7
  • 121
  • 131
  • Understood, however without reference to it, it seems that I can't use methods that I need, for example AppBuilderExtensions.CreatePerOwinContext (cannot resolve symbol error) – jimmious Jul 29 '15 at 13:07
  • 1
    These extensions were specially made for OWIN/Katana to make managers' lifetime management a bit easier. With dependency injection directly integrated to ASP.NET 5, they are no longer necessary (and won't work with ASP.NET Identity 3 anyway). – Kévin Chalet Jul 29 '15 at 13:09
  • Oh I see.. Hm although you answered my questions, you created many new ones hehe Is there some reliable source of information for Identity 3 so that I can adapt to it? I was following some quides and tutorials which are obviously kind of obsolete in that way.. (Thank you by the way!) – jimmious Jul 29 '15 at 13:16
  • You're welcome! The `IdentitySample.Mvc` sample you can find on github.com/aspnet/Identity is probably the best resource available right now: https://github.com/aspnet/Identity/tree/dev/samples/IdentitySample.Mvc. If you're looking for something more complete, don't miss the `MusicStore` sample: https://github.com/aspnet/MusicStore/tree/master/src/MusicStore – Kévin Chalet Jul 29 '15 at 13:19
  • Thanks again! I will give these a go. By the way the guide I was mostly following was this one here: http://bitoftech.net/2015/01/21/asp-net-identity-2-with-asp-net-web-api-2-accounts-management/ (Just so that I don't talk out of context) – jimmious Jul 29 '15 at 13:33
  • Taiseer's tutorials are indeed pretty good. FYI, if you're trying to port the whole sample to ASP.NET 5, you'll probably realize that there's no authorization/authentication server middleware in this new world. You can take a look at this question for possible alternatives: http://stackoverflow.com/questions/29055477/oauth-authorization-service-in-asp-net-mvc-6 – Kévin Chalet Jul 29 '15 at 13:44