Skip to main content

Notifications

Announcements

No record found.

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,

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,961 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans