Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

UserPasswordCredential could not be found

(0) ShareShare
ReportReport
Posted on by 20

I have used the Nuget package & version as  Microsoft.IdentityModel.Clients.ActiveDirectory (v. 5.2.7 - latest stable). It gives the error The type or namespace name "UserpasswordCredential" could not be found.

Any help on this much appreciated.

Thanks,

Raghavendra

  • RE: UserPasswordCredential could not be found

    Hello Saurabh,

    Thanks for your inputs. Unfortunately, it is not working. Also have used MSAL.Net (followed blog https://msftblog.com/using-msal-net-with-dynamics-365-webapi-in-dotnet-core/) which is returning the access token & when I give a call to products API I see below message & cannot move ahead.

    Failed to call the Web API: Forbidden

    Content: {"error":{"code": "0x80072560", "message": "The user is not a member of the organization."}}

    However, if I login to dynamics 365 crm & copy the URL (https://{Company}.api.crm8.dynamics.com/api/data/v9.1/products) in the browser I am able to get the response.

    Just a background:

    Have Azure active subscription & Dynamics 365 30 day trial.

    Thanks & Regards,

    Raghavendra Habbu

  • Suggested answer
    RE: UserPasswordCredential could not be found

    Hey Raghavendra,

    It appears that using UserPasswordCredential in .NET core is not recommended/supported currently because of the security risks it imposes as a result of storing the credentials within plain text.

    When you have a process running with no user interaction whatsoever, you should refer to the "Application Identity with OAuth 2.0 Client Credentials Grant" case of the "Daemon or Server Application to Web API" scenario. The following ADAL constructs will obtain an access token based on the app's identity only, and authenticate with either a client secret, a client assertion (i.e. a signed JWT token), or a client certificate (which will be used to create a signed JWT token). The resulting access token will not identify a user, and is only suitable when the token is for apps/APIs that have defined app-only permissions:

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

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,329 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans