Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Error "Audience not valid" when using TokenProvider.CreateSimpleWebTokenProvider(token)

$
0
0

When using TokenProvider.CreateSimpleWebTokenProvider(token) for aSubscriptionClient used with a MessagingFactory, I get a 401 error with the following information:

  • The token provider was unable to provide a security token while accessing 'https://<mynamespace>-sb.accesscontrol.windows.net/WRAPv0.9/'. Token provider returned message: 'Error:Code:401:SubCode:T2002:Detail:Audience not valid.:TraceID:6d345761-a7f8-47c7-9424-462ace879cf3:TimeStamp:2014-07-03 12:55:01Z'.

But that doesn't happen when using TokenProvider.CreateSharedSecretTokenProvider(issuerName, issuerKey) 

The issuer has both a password and a key. The ACS token request is valid - I get it with the following code:

static string GetAcsToken(string serviceNamespace, string issuerName, string issuerSecret) { var acsEndpoint = "https://" + serviceNamespace + "-sb.accesscontrol.windows.net/WRAPv0.9/"; // Note that the realm used when requesting a token uses the HTTP scheme, // even though calls to the service are always issued over HTTPS. var realm = "http://" + serviceNamespace + ".servicebus.windows.net/"; NameValueCollection values = new NameValueCollection(); values.Add("wrap_name", issuerName); values.Add("wrap_password", issuerSecret); values.Add("wrap_scope", realm); WebClient webClient = new WebClient(); byte[] response = webClient.UploadValues(acsEndpoint, values); string responseString = Encoding.UTF8.GetString(response); var responseProperties = responseString.Split('&'); var tokenProperty = responseProperties[0].Split('='); var token = Uri.UnescapeDataString(tokenProperty[1]); Console.WriteLine("Token: " + token); //return "WRAP access_token=\"" + token + "\""; return token; }

Please provide me with any help - thank you!



Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>