Error when trying to switch CrmServiceClient from the Office365 AuthType to OAuth AuthType

0
93
Forum Post: Change the Filter On option on Opportunity Associated View for Account form


So Im following this article to try and get our authentication switched over from Office365 to OAuth authentication because the Office365 auth type is deprecated: https://docs.microsoft.com/en-us/power-apps/developer/data-platform/authenticate-office365-deprecation#how-do-i-know-if-my-code-or-application-is-using-ws-trust

I have been trying various different connection strings for days now and i cant get this error to stop being thrown: “Unable to Login to Dynamics CRMOrganizationWebProxyClient is null”

This error isnt really helpful at all and i don’t understand whats wrong. Here is my connection string:

AuthType=OAuth; Url=https://XXX.crm.dynamics.com; Username=XXXXXXXXXXX; Password=XXXXXXXXXXX; AppId=51f81489-12ee-4a9e-aaae-a2591f45987d; RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97; LoginPrompt=Never

And Here is how I’m using it in my C# application:

            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

            string crmConn = ConfigurationManager.ConnectionStrings[“CRMConnection”].ConnectionString;

            var service = new CrmServiceClient(crmConn);
            return service;

But “service” always returns the above error. What am i doing wrong? How can i find a more useful error?



Source link

Leave a reply

Please enter your comment!
Please enter your name here