Note that there are some explanatory texts on larger screens.

plurals
  1. PODotNetOpenAuth Claimed Identifier from Facebook is never the same
    primarykey
    data
    text
    <p>I'm using DotNetOpenAuth v3.5.0.10357 and each time a user authenticates against Facebook I get a different claimed identifier back. The token looks to be encrypted so I assume DNOA is somehow encrypting the token along with the expiry. Can anyone confirm this? Or am I using it wrong:</p> <pre><code> public ActionResult FacebookLogOn(string returnUrl) { IAuthorizationState authorization = m_FacebookClient.ProcessUserAuthorization(); if (authorization == null) { // Kick off authorization request return new FacebookAuthenticationResult(m_FacebookClient, returnUrl); } else { // TODO: can we check response status codes to see if request was successful? var baseTokenUrl = "https://graph.facebook.com/me?access_token="; var requestUrl = String.Format("{0}{1}", baseTokenUrl, Uri.EscapeDataString(authorization.AccessToken)); var claimedIdentifier = String.Format("{0}{1}", baseTokenUrl, authorization.AccessToken.Split('|')[0]); var request = WebRequest.Create(requestUrl); using (var response = request.GetResponse()) { using (var responseStream = response.GetResponseStream()) { var graph = FacebookGraph.Deserialize(responseStream); var token = RelyingPartyLogic.User.ProcessUserLogin(graph, claimedIdentifier); this.FormsAuth.SignIn(token.ClaimedIdentifier, false); } } return RedirectAfterLogin(returnUrl); } } </code></pre> <p>Here's the code for FacebookAuthenticationResult:</p> <pre><code> public class FacebookAuthenticationResult : ActionResult { private FacebookClient m_Client; private OutgoingWebResponse m_Response; public FacebookAuthenticationResult(FacebookClient client, string returnUrl) { m_Client = client; var authorizationState = new AuthorizationState(new String[] { "email" }); if (!String.IsNullOrEmpty(returnUrl)) { var currentUri = HttpContext.Current.Request.Url; var path = HttpUtility.UrlDecode(returnUrl); authorizationState.Callback = new Uri(String.Format("{0}?returnUrl={1}", currentUri.AbsoluteUri, path)); } m_Response = m_Client.PrepareRequestUserAuthorization(authorizationState); } public FacebookAuthenticationResult(FacebookClient client) : this(client, null) { } public override void ExecuteResult(ControllerContext context) { m_Response.Send(); } } </code></pre> <p>Also, I am using the RelyingPartyLogic project included in the DNOA samples, but I added an overload for ProcessUserLogin that's specific to facebook:</p> <pre><code> public static AuthenticationToken ProcessUserLogin(FacebookGraph claim, string claimedIdentifier) { string name = claim.Name; string email = claim.Email; if (String.IsNullOrEmpty(name)) name = String.Format("{0} {1}", claim.FirstName, claim.LastName).TrimEnd(); return ProcessUserLogin(claimedIdentifier, "http://facebook.com", email, name, claim.Verified); } </code></pre> <p>It looks as though FacebookClient inherits from WebServerClient but I looked for the source on GitHub and I don't see a branch or a tag related (or at least not labeled) with the corresponding v3.5 version.</p>
    singulars
    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.
    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