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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Custom web application - Unable to Login to Dynamics CRM

(0) ShareShare
ReportReport
Posted on by 220

Hi Experts,

We are experiencing issues while connecting to CRM through custom code. The problem is that the same code works for same user sometimes but fails randomly for random users.

Let me share more details!

We have a custom web application developed using .NET. We are using CRM online and the number of users using this application are around 100. We connect to Dynamics CRM using CrmServiceClient, which allows us to connect using a connection string. This class is located in Microsoft.Xrm.Tooling.Connector. This web application is used by our CRM users who connect to this application by using their CRM credentials. The users are presented with a login page, they provide their credentials, on code side we use their credentials, dynamically construct our connecting string and try to connect to CRM using CrmServiceClient.

The problem is that the “Login” or the “Creating Connection” part of the code fails randomly for random users. The error is always the same, which is:
LastCrmError = Unable to Login to Dynamics CRM

Any idea that what could be the reason of this issue?

I have the same question (0)
  • Danny Vargas Profile Picture
    30 on at

    Hi Yaqud Ahmad,

    Did you tried with OAuth2 authentication? You can check this article: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/authenticate-oauth basically you need to create an application in Azure AD, with a client secret, you can impersonate your or the users with an app, creating an application users in D365.

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 83 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans