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?

  • Danny Vargas Profile Picture
    30 on at
    RE: Custom web application - Unable to Login to Dynamics CRM

    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 97

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans