0

I would like to write an ASP.NET 5 MVC6 website to interact with the BattleNet API.

The website is setup, I have created a BattleNet application authentication and key. Now I wish to authenticate against the BattleNet service but I do not know how to authenticate against the OAuth2 security using ASP.NET 5.

My research indicates that some part of security was not copied over for ASP.NET 5. BattleNet recommends using a well established library for OAuth2.

How do I authenticate against the BattleNet service using C# ASP.NET 5?

NB: Please provide answers and not confirmation of the situation.

DanAbdn
  • 7,151
  • 7
  • 27
  • 38

1 Answers1

1

There's an ASP.NET 5 middleware for Battle.NET: https://www.nuget.org/packages/AspNet.Security.OAuth.BattleNet/

You can find more information about this project - and the other providers - here: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/

Configuring it should be relatively easy:

app.UseBattleNetAuthentication(options => {
    options.ClientId = "client_id";
    options.ClientSecret = "client_secret";

    // America is the default region, but you can change it.
    options.Region = BattleNetAuthenticationRegion.Europe;
});
Kévin Chalet
  • 39,509
  • 7
  • 121
  • 131
  • Did you have a chance to test it? – Kévin Chalet Nov 26 '15 at 19:18
  • Tried but it wouldn't even compile in asp.net 5 mvc6 due to a missing NotNull attribute that I couldn't resolve...I looked and I looked and I looked. That coupled with no documentation of steps involved led to some frustration. Any other libraries out there? – DanAbdn Nov 26 '15 at 22:01
  • Heh, you don't need to resolve `NotNull` since it's a build time dependency, only meant for tools like Resharper. Just add the package name to the "dependencies" node of your project.json and it should work. If it doesn't, upload a repro somewhere and I'll take a look. – Kévin Chalet Nov 26 '15 at 22:07
  • There was other stuff failing too – DanAbdn Nov 26 '15 at 22:11
  • I'm not very good at psychic debugging. Anyway, good luck with your research. – Kévin Chalet Nov 26 '15 at 22:13