Monday, 15 March 2010

oauth - DotNetOpenAuth Bad Request on ProcessUserAuthorization -


"itemprop =" text ">

I am implementing the use of the SSO process (OAuth 2.0) DotNetOpenAuth example. Solution 3 projects (web client, authorization server, and resource servers) authorization server after the authorization code returned to the client I've got an issue in the stage of processing user authorization response

  http .: //localhost/OAuthClient/SampleWcf2.aspx?code=xxx&state=L6SAxlXhlxwsBRcTCK3IAw  

exception:

  [WebException: the remote server returned an error :. (400) went to the wrong request] System.Net.HttpWebRequest.GetResponse () 8,765,848 DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse (HttpWebRequest request, DirectWebRequestOptions option) 271 [ProtocolException: error while sending a direct message or response. ] DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse (HttpWebRequest request, DirectWebRequestOptions option) +2261 DotNetOpenAuth.Messaging.Channel.RequestCore (IDirectedProtocolMessage request) +516 DotNetOpenAuth.Messaging.Channel.Request (IDirectedProtocolMess age requestMessage) 138 DotNetOpenAuth.OAuth2.ClientBase.UpdateAuthorizationWithResponse (IAuthorizationState authorizationState, EndUserAuthorizationSuccessAuthCodeResponse authorizationSuccess) 210 DotNetOpenAuth.OAuth2.WebServerClient.ProcessUserAuthorization (HttpRequestBase Request) 904 OAuthClient.SampleWcf2.Page_Load (Object Sender, EventArgs e) 118 System Web.UI.Control.LoadRecursive () 71 System.Web.UI.Page.ProcessRequestMain (Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3178  

Here is my code:

  Protected Zero Page_load (Object Sender, EventArgse E) {if (! IsPostBack) Check // Check whether we are receiving end user authorization feedback. Var authenticity = Client. Process user authorization (); // Temp if (authorization! = Null) {// We're receiving an authorization response, store it and associate it with this authorization authority = authorization; Response.Redirect (Request.Path); / / Code = to get rid of the parameter}} If (authorization! = Zero) / / inform the user that we have already received authorization on some of these Where (li => authority. Scope consignment (li.Value)) {li.Selected = true; } This.authorizationLabel.Text = "Authorization Received!"; If (Authorization.AccessTokenExpirationUtc.HasValue) {TimeSpan timeLeft = Authorization.AccessTokenExpirationUtc.Value - DateTime.UtcNow; This.authorizationLabel.Text + = string.Format (CultureInfo.CurrentCulture, "(entry token expires in {0} minutes)", Math. Round (Time-Left total minutes, 1)); }} This.getNameButton.Enabled = this.getAgeButton.Enabled = this.getFavoriteSites.Enabled = Authorization! = Null; }  


No comments:

Post a Comment