<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using OAuth Providers with MVC 4</title><link>http://asp.net</link><pubDate>Tue, 26 Feb 2013 18:03:26 GMT</pubDate><generator>umbraco</generator><description>Comments for Using OAuth Providers with MVC 4</description><language>en</language><atom:link href="http://asp.net/rss/comments/43323" rel="self" type="application/rss+xml" /><item><title>Comment Posted by Anthony Dewhirst</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Wed, 19 Dec 2012 14:27:14 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017036</guid><description><![CDATA[ <p>Hi Tom, </p><p>Nice intro to using the OAuth stuff, exactly what I was looking for.</p><p>One thing that I had to do though was in the </p><p>I had to change</p><p>    public DbSet UserProfiles { get; set; }</p><p>    public DbSet ExternalUsers { get; set; }</p><p></p><p>to use the generic types. I take it that you have them in the source (just checked and you do) so obv these need encoding.</p><p></p><p>Cheers</p><p>Anthony</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/Anthony%20Dewhirst.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by dbacher</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Mon, 31 Dec 2012 16:58:52 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017092</guid><description><![CDATA[ <p>Is it really too much to ask for you guys to provide 20ish lines of code to have a RegisterOpenIDProvider(providerUri) method?  </p><p></p><p>I can understand not allowing users to enter arbitrary OpenID&#39;s.  I can even understand, only to a point, not supporting PPID.  I can&#39;t understand why there&#39;s no way to populate ClaimsIdentity with the claims from Yahoo, Google, Facebook, Twitter since DotNetOpenAuth has code for getting a list of URI/value pairs.But, I will give you, this is 1000x better than u/p.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/dbacher.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Wed, 02 Jan 2013 17:55:29 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017101</guid><description><![CDATA[ <p>Anthony, thanks for your feedback. I have fixed the topic as you suggested.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Wed, 02 Jan 2013 18:51:07 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017102</guid><description><![CDATA[ <p>dbacher, if I understand your request correctly, you may have a couple of options. The DotNetOpenAuth.AspNet.Clients namespace has OpenID clients for Google and Yahoo. It also has the OpenIdClient class which you can derive from to create a custom OpenID client.</p><p></p><p>The blog post at <a rel="nofollow" href="http://blogs.msdn.com/b/webdev/archive/2012/08/23/plugging-custom-oauth-openid-providers.aspx" target="_blank">blogs.msdn.com/</a> has an example of creating a custom client and a link to the source code for the clients.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jdbenn</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Wed, 09 Jan 2013 23:31:38 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000017149</guid><description><![CDATA[ <p>Thanks for putting this out there.  I am very new to MVC and this article helped a lot.  </p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/jdbenn.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by adharbert</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Mon, 21 Jan 2013 09:11:27 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018214</guid><description><![CDATA[ <p>Can anyone suggest a good place to walk me through the registration setup for Facebook?  I&#39;m not sure if FB changed, but I don&#39;t see how to register with them.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/adharbert.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by adharbert</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Mon, 21 Jan 2013 12:34:22 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018218</guid><description><![CDATA[ <p>I&#39;m trying this part, adding the custom fields and it doesn&#39;t recognize the new fields at all.</p><p></p><p>AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication(</p><p>    Url.Action(&quot;ExternalLoginCallback&quot;, new { ReturnUrl = returnUrl }));</p><p></p><p>Can anyone explain why adding the new fields to the Url.Action() isn&#39;t working?  after the ReturnUrl = returnUrl I&#39;m adding ,Id = id and it doesn&#39;t recognize the new fields.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/adharbert.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Tue, 22 Jan 2013 18:03:44 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018228</guid><description><![CDATA[ <p>adharbert, it looks like you may have gotten past the Facebook registration step, but just in case, you need to verify your Facebook account as a developer account. There is some information at <a rel="nofollow" href="http://www.facebook.com/help/221607984627895/" target="_blank">www.facebook.com/</a> about verifying a dev account.</p><p></p><p>After verifying your account, you should see an Apps tab on the Facebook Developers site &lt;a rel=&quot;nofollow&quot; target=&quot;_new&quot; href=&quot;https://developers.facebook.com/&quot; target=&quot;_blank&quot;&gt;https://developers.facebook.com/&lt;/a&gt; . From that page, you can create a new app.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Tue, 22 Jan 2013 18:48:19 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018229</guid><description><![CDATA[ <p>adharbert, the values from Facebook that correspond to the custom properties are passed back in the AuthenticationResult object. Therefore, you retrieve them with code like result.ProviderUserId or result.ExtraData[&quot;id&quot;]. You do not need to pass in any of those values when calling OAuthWebSecurity.VerifyAuthentication.</p><p></p><p>Let me know if I have completely misunderstood your question.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by mariosaccoia@hotmail.it</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Wed, 23 Jan 2013 06:26:16 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018235</guid><description><![CDATA[ <p>Fantastic post!!! ;)</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/mariosaccoia@hotmail.it.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by babukotha</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Fri, 25 Jan 2013 06:13:11 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018247</guid><description><![CDATA[ <p>Getting the below error after clicking the &quot;Go to App&quot; button.</p><p>     The remote name could not be resolved: &#39;graph.facebook.com&#39;</p><p></p><p>Thanks,</p><p>Ramesh Babu Kotha</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/babukotha.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by hairgami</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Fri, 25 Jan 2013 17:06:53 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018252</guid><description><![CDATA[ <p>Hi Tom-</p><p>Thanks for your excellent tutorial- usually tutorials of this complexity don&#39;t work- yours did perfectly.</p><p></p><p>Can you recommend a technique to manipulate the ExtraUserInformation table beyond this registration/login process? For instance, I&#39;d like users to be able to manually submit their Phone Number to the the Extra User Information table. Besides modifying the model to accommodate this new field, what&#39;s the best way to select the current user from the db Context, add &amp; save the data?</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/hairgami.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Tue, 29 Jan 2013 16:27:57 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018278</guid><description><![CDATA[ <p>hairgami, for something like manually entering a Phone Number, you might be best off adding a PhoneNumber property to the UserProfile class. Then, you can work with it like this:</p><p>using (UsersContext db = new UsersContext())</p><p>{</p><p>  UserProfile user = db.UserProfiles.FirstOrDefault(u =&gt; u.UserName == User.Identity.Name);</p><p>  user.PhoneNumber = &quot;xxx-xxx-xxxx&quot;;</p><p>  db.SaveChanges();</p><p>} </p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Tue, 29 Jan 2013 16:28:32 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018279</guid><description><![CDATA[ <p>If you needed to get the ExternalUserInformation for that user, you could add:</p><p>ExternalUserInformation userinfo = db.ExternalUsers.FirstOrDefault(e =&gt; e.UserId == user.UserId);</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by ITWhisperer</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Fri, 01 Feb 2013 16:56:08 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018297</guid><description><![CDATA[ <p>I have found your example to be extremely helpful since I am new to the development world. I was wondering if you would possibly have any advice or guidance on where I could find some helpful information about how to add an email permissions request to what you have provided. It seems the little bit of information that I have found is fragmented and I am a little confused at this point. I greatly appreciate any help with this. Thank you!</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/ITWhisperer.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Mon, 04 Feb 2013 16:59:44 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018339</guid><description><![CDATA[ <p>ITWhisperer, depending on the versions of the DotNetOpenAuth NuGet packages in your project, you may already be requesting the email permission. When I first wrote the tutorial, the Facebook client I had installed did not request email permission. However, I updated the DotNetOpenAuth NuGet packages in my project today, and now email is included in the request.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Mon, 04 Feb 2013 17:01:54 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018340</guid><description><![CDATA[ <p>ITWhisperer - Then, in the ExternalLoginConfirmation method, retrieve the email property in the same line that you retrieve the verified property:</p><p>dynamic response = client.Get(&quot;me&quot;, new { fields = &quot;verified,email&quot; });</p><p></p><p>You can use the value with: </p><p>response[&quot;email&quot;]</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by enstam66</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Thu, 07 Feb 2013 05:06:44 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018362</guid><description><![CDATA[ <p>Hi Tom, </p><p></p><p>First of all, thanks for this clear article. </p><p></p><p>Unfortunately I cannot get the Facebook login to work. I have followed your article step-by-step, but when I log into Facebook I get a time-out on the ExternalLoginCallback method: &quot;A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 173.252.110.27:443&quot;.</p><p></p><p>Can you help?</p><p>Regards, Erwin</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/enstam66.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by enstam66</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Thu, 07 Feb 2013 07:50:27 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018365</guid><description><![CDATA[ <p>Hi Tom,</p><p></p><p>figured it out! It was the proxy server that caused my problem. Everything works great now. Thanks again for the great article.</p><p></p><p>Kind regards,</p><p>Erwin</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/enstam66.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by subsci</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Fri, 08 Feb 2013 01:17:20 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018381</guid><description><![CDATA[ <p>Difficult for me to implement       public class MyGoogleOAuthClient : DotNetOpenAuth.AspNet.Clients.OAuth2Client.</p><p></p><p>Why not use OpenId for Google, as it is part of the template?   Well the REAL LIFE challenge is two-fold. One:  get this working for Google.   Two: with the knowledge gained, implement another class for an arbitrary OAuth2 server.   So challenge two is real life.  </p><p></p><p>I am using as an example  dotnetopenid / src / DotNetOpenAuth.AspNet / Clients / OAuth2 / MicrosoftClient.cs .   But I am at the cusp of the difficult part.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/subsci.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by valryk</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Wed, 13 Feb 2013 19:53:25 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018425</guid><description><![CDATA[ <p>Thank you for this explanation, though I am not using MVC but asp.net forms.</p><p>So I created a new webform app in VS2012 and followed the instructions per the first article I found following the link in the application login page:</p><p><a rel="nofollow" href="http://blogs.msdn.com/b/webdev/archive/2012/08/15/oauth-openid-support-for-webforms-mvc-and-webpages.aspx" target="_blank">blogs.msdn.com/</a>#comments</p><p></p><p>but after trying successfully to connect via Twitter I am a bit confused about an aspect of authenticating with external services (didn&#39;t try with Facebook, but I guess the question could apply the same):</p><p></p><p>if I have two different &quot;physical&quot; users (i.e. unrelated persons) visiting my site, user A registered yesterday with my site local registration form with username &quot;dummyfoo&quot; and a email/password; while today user B arrives and authenticates with twitter, where he has the &quot;dummyfoo&quot; username, he is redirected to my site and being logged in and welcomed as being the same person as User A.....!!!</p><p>Am I missing something or there is a flaw?</p><p>Thanks</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/valryk.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Thu, 14 Feb 2013 15:32:31 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018431</guid><description><![CDATA[ <p>valryk, I tried a quick test of a web forms project. I registered a local account with the same username as a Facebook account. Logged out. Then, registered through Facebook. I received an error that the username is already in use. </p><p></p><p>It is possible to associate an external login to a logged-in account. Is there any chance that happened?</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by acohen-tempworks</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Thu, 21 Feb 2013 15:14:02 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018487</guid><description><![CDATA[ <p>Tom, this is a great comprehensive dive into how to set this all up.  As far as I can tell, this methods requires that you are using an ExtendedMembershipProvider, correct?</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/acohen-tempworks.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by dermax</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Fri, 22 Feb 2013 15:30:15 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018501</guid><description><![CDATA[ <p>Hey Tom, </p><p></p><p>thanks for that great tutorial. helped me a lot.</p><p></p><p>i was wondering, why i can&#39;t find any complete information on how to integrate an asp.net mvc website with windows live. for example about oauth... why dont you explain live? I know ist realy easy to do that. but what about getting extra info? </p><p></p><p>and... maybe someone in your Team could make a tutorial on how to integrate all those cool live features like skydrive and so on. :-)</p><p></p><p>max</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/dermax.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by tomfitz</title><link>http://asp.net/mvc/tutorials/mvc-4/using-oauth-providers-with-mvc</link><pubDate>Tue, 26 Feb 2013 18:03:26 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018525</guid><description><![CDATA[ <p>acohen, to take advantage of the built-in behavior you would have to continue using the default SimpleMembershipProvider. You might be able to use OAuthWebSecurity with a different membership provider. This blog might be helpful, but I haven&#39;t tried implementing it. <a rel="nofollow" href="http://brockallen.com/2012/09/04/using-oauthwebsecurity-without-simplemembership/" target="_blank">brockallen.com/</a></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/tomfitz.jpg?forceidenticon=false&amp;dt=635045475000000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>