Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login with Steam in ASP.NET MVC5

I have recently been playing around with ASP.NET MVC5 and the new OWIN authentication middleware. I want my users to login with their Steam account and password. After a user logs in successfully, I just need the Steam Account Id for further processing. Steam can act as an OpenId Provider as stated in the documentation.

In MVC4 one would implement a custom OpenIdClient. It seems to me that in MVC5 the OpenIdClient class has been removed and authentication is configured using the IAppBuilder class which offers methods to login with Facebook, Google and other predefined providers.

Unfortunately, I haven't been able to find any documentation about plugging a custom provider to the new authentication system. Can you give me any instructions or references?

like image 969
Shackles Avatar asked Oct 20 '13 12:10

Shackles


1 Answers

This is an answer to the bounty that was placed by @Buzinas.

This solution is going to use the NuGet package Owin Security Providers which is available here.

Go to the Package Manager Console (Tools -> Library Package Manager -> Package Manager Console) and install the above package:

Install-Package Owin.Security.Providers

In your App_Start\Startup.Auth.cs add the proper using statement. For Steam, you want

using Owin.Security.Providers.Steam;

Side note, there are several options available, so this package isn't just for Steam. Owin.Security.Providers

In the ConfigureAuth method, add app.UseSteamAuthentication("<<API KEY>>");

<<API_KEY>> should be replaced with the API key you received from Valve

like image 139
Andy Avatar answered Oct 01 '22 14:10

Andy