Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found my mistake. I had a fundamental misunderstanding of what constituted the token. For some reason I got it in my head that it was the text that followed "HMACSHA256" when in fact the token was everything in the response that follows "wrap_access_token=" (which seems obvious now...)</p> <p>Anyway, if anyone else has this issue, the 500 error code is being thrown because the token is being correctly retrieved but the wrong token is being added to the request header. I tested this by attaching "GARBAGETOKEN" and observing the same behavior.</p> <p>The following is a valid GetToken method:</p> <pre><code>static string GetToken(string serviceNamespace, string issuerName, string issuerPassword) { if (_token == null) { string acsEndpoint = "https://" + serviceNamespace + "-sb.accesscontrol.windows.net/WRAPv0.9"; string relyingPartyAddress = "http://" + serviceNamespace + ".servicebus.windows.net"; NameValueCollection postData = new NameValueCollection { { "wrap_scope", relyingPartyAddress }, { "wrap_name", issuerName }, { "wrap_password", issuerPassword }, }; WebClient webClient = new WebClient(); byte[] responseBuffer = webClient.UploadValues(acsEndpoint, "POST", postData); string response = Encoding.UTF8.GetString(responseBuffer); string token = response.Split('&amp;') .Single(value =&gt; value.StartsWith("wrap_access_token=") ) .Split('=')[1]; _token = HttpUtility.UrlDecode(token); } return _token; } static string _token = null; </code></pre> <p>Hopefully my folly helps someone else :)</p>
 

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