Note that there are some explanatory texts on larger screens.

plurals
  1. POPrepareRequestUserAuthorizationAsync fails
    primarykey
    data
    text
    <p>I had very simple code which worked fine for me:</p> <pre><code>var url = System.Web.HttpContext.Current.Request.Url; Uri callbackUrl = new System.Uri(url, "oAuth2CallBack"); var ub = new UriBuilder(callbackUrl); // decodes urlencoded pairs from uri.Query to var var httpValueCollection = HttpUtility.ParseQueryString(callbackUrl.Query); httpValueCollection.Add(UrlArguments.Param, null); // urlencodes the whole HttpValueCollection ub.Query = httpValueCollection.ToString(); var authorizationRequest = OAuthClient.PrepareRequestUserAuthorization(new[] { "somedata" }, ub.Uri); authorizationRequest.Send(); </code></pre> <p>I've updated OAuth's NuGet packages and rewrite the code this way:</p> <pre><code>var url = System.Web.HttpContext.Current.Request.Url; Uri callbackUrl = new System.Uri(url, "oAuth2CallBack"); var ub = new UriBuilder(callbackUrl); // decodes urlencoded pairs from uri.Query to var var httpValueCollection = HttpUtility.ParseQueryString(callbackUrl.Query); httpValueCollection.Add(UrlArguments.Param, null); // urlencodes the whole HttpValueCollection ub.Query = httpValueCollection.ToString(); var client = new WebServerClient(new AuthorizationServerDescription { TokenEndpoint = Configuration.OAuth2.TokenEndpoint, AuthorizationEndpoint = Configuration.OAuth2.AuthorizationEndpoint, }, clientIdentifier: Configuration.OAuth2.ClientIdentifier, clientCredentialApplicator: ClientCredentialApplicator.PostParameter( Configuration.OAuth2.ClientSecret)); var authorizationRequest = await client.PrepareRequestUserAuthorizationAsync(new[] { "somedata" }, ub.Uri); await authorizationRequest.SendAsync(); </code></pre> <p>but <code>PrepareRequestUserAuthorizationAsync</code> throws exception </p> <blockquote> <p>"Attempt by method 'DotNetOpenAuth.OAuth2.WebServerClient+d__3.MoveNext()' to access method 'System.Collections.Generic.List`1..ctor()' failed."</p> </blockquote>
    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.
    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