Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing OpenID in ASP.Net MVC3, where do I get the user data?
    primarykey
    data
    text
    <p>I realize OpenID is somewhat of a behemoth, or more complex than a typical registration form, but I feel I'm missing something here.</p> <p>According to this <a href="https://stackoverflow.com/questions/6164847/if-openid-what-user-data-do-i-still-need-to-save">question</a>, I'm supposed to save the unique identifier key I'm given by my provider.</p> <blockquote> <p>The provider will give you a unique ID for each user - this you need to save. It's how you will match up the user that just logged in with a record in your database.</p> </blockquote> <p>In <a href="http://www.dotnetopenauth.net/developers/help/programmatic-openid-relying-party/" rel="nofollow noreferrer">my code (taken from the MVC portion)</a>, this unique ID is given inside the switch in the <code>LogOn()</code> action method:</p> <pre><code>public ActionResult LogOn() { var openid = new OpenIdRelyingParty(); IAuthenticationResponse response = openid.GetResponse(); if (response != null) { switch (response.Status) { case AuthenticationStatus.Authenticated: FormsAuthentication.RedirectFromLoginPage( response.ClaimedIdentifier, false); // &lt;-------- ID HERE! "response.ClaimedIdentifier" break; case AuthenticationStatus.Canceled: ModelState.AddModelError("loginIdentifier", "Login was cancelled at the provider"); break; case AuthenticationStatus.Failed: ModelState.AddModelError("loginIdentifier", "Login failed using the provided OpenID identifier"); break; } } return View(); } [HttpPost] public ActionResult LogOn(string loginIdentifier) { if (!Identifier.IsValid(loginIdentifier)) { ModelState.AddModelError("loginIdentifier", "The specified login identifier is invalid"); return View(); } else { var openid = new OpenIdRelyingParty(); IAuthenticationRequest request = openid.CreateRequest(Identifier.Parse(loginIdentifier)); // Require some additional data request.AddExtension(new ClaimsRequest { BirthDate = DemandLevel.NoRequest, Email = DemandLevel.Require, FullName = DemandLevel.Require }); return request.RedirectingResponse.AsActionResult(); } } </code></pre> <p>Do I use this identifier for the <code>FormsAuthentication.SetAuthCookie(IDHERE, true);</code>?</p> <p>What if I want to also save the users information, such as email, name, nickname or whatever. How do I get this collection of data from the relying party? In case this process depends on the provider I'm using, I am using Steam OpenID provider:</p> <p><a href="http://steamcommunity.com/openid" rel="nofollow noreferrer">http://steamcommunity.com/openid</a> <a href="http://steamcommunity.com/dev" rel="nofollow noreferrer">http://steamcommunity.com/dev</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload