Passing Authorization/Bearer Token Back to SalesForce | XM Community
Skip to main content
Hello,



After making a successful authentication call to SalesForce via Survey Flow - Web Service block, I am having trouble calling a different subsequent SalesForce web service where I pass back the newly created token specified in a header parameter. I receive this (raw) error response:



`[{"message":"INVALID_HEADER_TYPE","errorCode":"INVALID_AUTH_HEADER"}]`



After successful authentication, I save the authorization token as an embedded data variable in 'access_token'. On the subsequent web service call, I create a 'Custom Headers' name-value pair:



!



However, as I mentioned, I get an error during testing of the web service.



I tried hardcoding the access token value during testing as



`Authorization = Bearer <ACTUAL_TOKEN_VALUE>`



But I get this error message instead:



`[{"message":"MediaType of 'application/x-www-form-urlencoded' is not supported by this resource","errorCode":"UNSUPPORTED_MEDIA_TYPE"}]`



I know the web service I am talking to works because using curl as below I get the response I expect.



`curl https://mysforg.salesforce.com/services/mywebservice -H 'Authorization: Bearer <ACTUAL_TOKEN_VALUE>' -H "Content-Type: application/json`



Any help is greatly appreciated!
The second/subsequent call I am calling is a query on field values for an object. It turns out changing the changing the Method (http action) from POST to GET did the trick, at least for this use case 🙂.

Leave a Reply