i want to connect to my dynamic 365 dataverse and by my first environment its works fine but now its not working,this is the steps that i do, i go to azure active directory and register a app with Multitenant access, and make api permissions to dataverse/dynamics and create a client secret but i get an error by trying to connect to dataverse here is my code
static void Main(string[] args)
{
string url = "">mydomain.crm.dynamics.com";
// e.g. you@yourorg.onmicrosoft.com
string conn = $@"
Url = {url};
AuthType = ClientSecret;
AppId = myappid;
ClientSecret =my client secret;
RedirectUri = login.microsoftonline.com/.../nativeclient;
LoginPrompt=Auto;
RequireNewInstance = True";
using (var svc = new CrmServiceClient(conn))
{
WhoAmIRequest request = new WhoAmIRequest();
WhoAmIResponse response = (WhoAmIResponse)svc.Execute(request);
Console.WriteLine("Your UserId is {0}", response.UserId);
Console.WriteLine("Press any key to exit.");
Console.ReadLine();
}
and i get an error System.NullReferenceException: 'Object reference not set to an instance of an object.', by the line WhoAmIResponse response = (WhoAmIResponse)svc.Execute(request);
and by a other connection method i get a response
The HTTP request was forbidden with client authentication scheme 'Negotiate'.
if anyone can guide me what step i missing in the app configuration
thanks