Apurv's Dynamics 365 Blog

Code Samples & Troubleshooting Tips on Dynamics 365!

Issues authenticating to CRM Online organizations "An unsecured or incorrectly secured fault was received from the other party"

Hello Developers,
This article is most interesting and life saver for who are in trouble with authenticating to CRM Online organizations. Microsoft recently announced about moving organization to integrated O365 environment. Looks awesome!! Does this mean you’ll need to revisit your code?? Yes you will need to 🙂
I’ve framed couple of questions which may cross your mind.

What has changed?
The CRM SDK has been revised with newer functions like “Authenticate()” to make our life easier. This returns security token response that is used in the service proxy constructor. We now use IServiceManagement Generic Interface to pass through authentication. For more details, please check http://msdn.microsoft.com/en-us/library/hh670628.aspx.

What error do I see when using older code against O365 based authentication?
The error is pretty generic and restricted to authentication failure in WCF layer. The typical error message is below

Do we have a sample?
Yes we do have a sample code available http://msdn.microsoft.com/en-us/library/hh675404 with helper class http://msdn.microsoft.com/en-us/library/gg309393 which is revised to embed this part. You might want to look at http://blogs.msdn.com/b/apurvghai/archive/2012/07/29/authenticate-office-365-users-with-microsoft-dynamics-crm-online.aspx. I have simplified the approach for smooth usage.

Is there any other thing I need to look at?
Yes you need to be aware of discovery URL changes. We now use https://disco.crm.dynamics.com/XRMServices/2011/Organization.svc Please refer this article http://msdn.microsoft.com/en-us/library/gg309401.aspx to choose correct endpoints.

I also noticed a blog post available from Microsoft talking about ongoing issues with CRM Online organizations. Check out for more insights https://community.dynamics.com/product/crm/crmtechnical/b/crmonlineservice/default.aspx

Hope this helps!! Let me know if you have something I can add here 🙂