Reputation: 61
I am trying to learn the dataverse API using C#. I am following the code in this github: https://github.com/microsoft/PowerApps-Samples/blob/master/dataverse/orgsvc/C%23-NETCore/GetStarted/ConsoleApp%20(public)/Program.cs
I changed the login information and the appID to my app registration's client id and added a redirect URL of http://localhost.
The app registration does have API permissions to Dynamics CRM.
However, I still get an error
Original exception: AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'
This is my connection string:
static string connectionString = $@"
AuthType = OAuth;
Url = {url};
UserName = {userName};
Password = {password};
AppId = {appId};
RedirectUri = http://localhost;
LoginPrompt=Auto;
RequireNewInstance = True";
I cannot figure out what the issue is. Any help would be greatly appreciated.
Upvotes: 0
Views: 1228
Reputation: 23
Create a new secret for your application registration in Active Directory/Entra and include it in the connection string as the 'client_secret' parameter. With this, you will not need your username and password in the connection string.
Upvotes: 0
Reputation: 7948
Do not modify the value of setting AppId
.
In the connection string it should be set like this: AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;
Upvotes: 1