web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

WS-Trust Authentication Error

(0) ShareShare
ReportReport
Posted on by 45

Hi ALL-IN ,

I am getting a WS-Trust Authentication error in my console application(which consumes API) due to WS-Trust and Office365 authentication being removed.

comunityApi.txt

I know it can be resolved by OAuth Authentication but need to replace IOrganizationService.

need some help on how to replace IOrganizationService .

I have also attached the code for reference.

Thanks,

I have the same question (0)
  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at
    RE: WS-Trust Authentication Error

    Hi,

    You need to use below code to connect to CRM

    public IOrganizationService createConnection()

           {

               try

               {

                   CrmServiceClient crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["MyCDSServer"].ConnectionString);

               if (crmSvc.IsReady)

               {

                    return crmSvc ;

               }

               else

    {

    Console.WriteLine("Error:"+crmSvc .LastCrmError);

    return null;

    }

               }

               catch (Exception ex)

               {

                   // Console.WriteLine("Exception caught - " + ex.Message); //TTC_KH_ConsoleComment

               }

               return null;

           }

    <connectionStrings>  

       <add name="MyCDSServer" connectionString="AuthType=OAuth;Username=;Password=;Url=;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Auto" />

    </connectionStrings>

    Add Username and password.

    You will need to add below package from nuget manager -

    www.nuget.org/.../

    xrmdynamicscrm.wordpress.com/.../

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 65 Super User 2025 Season 2

#2
Siv Sagar Profile Picture

Siv Sagar 52 Super User 2025 Season 2

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans