+ Start a Discussion
GauravTrivediGauravTrivedi 

Salesforce Azure Integration, Error in getting token

Hi,

I am trying to integrate salesforce and some application via azure service bus. Code i used is: 
            Http h = new Http();
            HttpRequest req = new HttpRequest();
            // ** Getting Security Token from STS
            String Url = 'https://XXXX.accesscontrol.windows.net/WRAPv0.9/';
            // String encodedPW = EncodingUtil.urlEncode([password]', 'UTF-8');
            req.setEndpoint(Url);
            req.setMethod('POST');
            req.setBody('wrap_name=SenderTest&wrap_password=XXXXX==&wrap_scope=http://XXXX.servicebus.windows.net/MenuService');
            req.setHeader('Content-Type','application/x-www-form-urlencoded');
            HttpResponse res = h.send(req);
            result = res.getBody();


And I am getting result =  
Error:Code:400:SubCode:T0:Detail:ACS90004: The request is not properly formatted.:TraceID:848b16db-dd8c-406e-8239-d96428e70f11:TimeStamp:2014-05-13 11:39:31Z

I am not able to get token. please help me out for the same...
Best Answer chosen by GauravTrivedi
GauravTrivediGauravTrivedi
@ Shashank 
i have decoded password,I think in this case I dont need to use UrlEncode(). 

All Answers

Shashank SrivatsavayaShashank Srivatsavaya
Hi,

This looks like an azure related error message. Please see if this helps: http://social.msdn.microsoft.com/Forums/en-US/c8406a0c-4f81-4e41-af46-34eb44ca0161/error-when-retrieve-access-token-using-fiddler?forum=microsofttranslator

If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.

Thanks,
Shashank
GauravTrivediGauravTrivedi
@Shashank 
Thank you for your response, I am getting this result at salesforce side from Azure. I dont know how to fix it. If you get any other solution please share.
Shashank SrivatsavayaShashank Srivatsavaya
Hi,

From what I lookued up, "ACS90004" is a microsoft error code. Please try to UrlEncode() the client secret when requesting the access token. The problem happens only with client secrets containing a URL reserved character.
GauravTrivediGauravTrivedi
@ Shashank 
i have decoded password,I think in this case I dont need to use UrlEncode(). 
This was selected as the best answer