DotNetOpenAuth oAuth in ASP.NET MVC

18,486

Solution 1

You may want to look at the sample projects that come along with the DotNetOpenAuth source code.

The solution obtained on unzipping has several sample projects in it. One of them is an Oauth consumer implementation. Though it is a ASP.NET Webforms application, reimplementing it as an ASP.NET MVC application shouldn't be too hard.

Solution 2

I've recently created a NuGet package that adds auth with Facebook, Twitter, Google to any ASP.NET MVC 3 page - in a very simple and extensible manner - and it's based on DotNetOpenAuth. Take a look:

https://nuget.org/packages/SimpleSocialAuth.MVC3/

and the source is on github:

https://github.com/rafek/SimpleSocialAuth

Solution 3

Have a look at Rob Conery's TekPub ASP.Net MVC 2.0 Starter Site. He has setup DotNetOpenAuth as part of that. It should point you in the right direction

EDIT
My assumption was based on the the fact the OpenID and OAuth are the same. They are not the same but complimentary ideas. OpenId is about Authentication where as OAuth is about Authorization.

While not directly related to ASP.NET MVC the TweetSharp Library has an OAuth implementation written in C# that may be of some use.

TweetSharp OAuth workflow
Simple OAuth integration for Twitter in ASP.NET MVC

OAuth with Silverlight for Windows Phone 7

Solution 4

There are now tutorials online that show how to do this. Here is one: OpenID and OAuth using DotNetOpenAuth in ASP.NET MVC from Random Sparks

Share:
18,486
Farmer Blake
Author by

Farmer Blake

Consultant in New York City: http://www.nikcodes.com/

Updated on June 24, 2022

Comments

  • Farmer Blake
    Farmer Blake almost 2 years

    I'm trying to understand how to apply the oAuth consumer library from DotNetOpenAuth in the context of ASP.NET MVC.

    oAuth is new to me, and the library doesn't seem very simple. Does anyone have a sample of leveraging this library, for this usage, in ASP.NET MVC?

  • Farmer Blake
    Farmer Blake almost 14 years
    Thanks for the link Nathan, however it doesn't appear that Rob has any oAuth implementation in the Starter Site.
  • Sughiy
    Sughiy almost 14 years
    @nikmd23 I did make the assumtion that OpenId and OAuth are the same. My apologies if that is not the case. Have a look in the Controllers/SessionController Authenticate method and the Views/Session/Create.aspx file. The implementation that I was referring to is there.
  • Sughiy
    Sughiy almost 14 years
    Added a couple of links that may be of value
  • Levitikon
    Levitikon over 11 years
    dead link, it's here instead: dotnetopenauth.net
  • GreyCloud
    GreyCloud almost 11 years
    does this support MVC 4? the NuGet package seems to be MVC3
  • rafek
    rafek over 10 years
    @GreyCloud some guys are working on an MVC4 branch, check it on GitHub