title: Body must contain client_secret or client_assertion
body: <p>I registered new application as <strong>Web app / API</strong> (not native), added permission to <strong>Access Dynamics 365 as organization users</strong>.</p>
  
  <p><a href="https://i.stack.imgur.com/R8Y6S.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R8Y6S.png" alt="enter image description here"></a></p>
  
  <p>I following this guide (<a href="https://code.msdn.microsoft.com/simple-web-api-quick-start-e0ba3d6b" rel="nofollow noreferrer">https://code.msdn.microsoft.com/simple-web-api-quick-start-e0ba3d6b</a>) which has the below code, the only difference is that I have updated my <code>Microsoft.IdentityModel.Clients.ActiveDirectory</code> library which required small code change. </p>
  
  <pre><code>//Obtain the Azure Active Directory Authentication Library (ADAL)    
  AuthenticationParameters ap = AuthenticationParameters.CreateFromResourceUrlAsync(new Uri(serviceUrl + "api/data/")).Result;
  
  AuthenticationContext authContext = new AuthenticationContext(ap.Authority, false);
  
  //Note that an Azure AD access token has finite lifetime, default expiration is 60 minutes.
  AuthenticationResult authResult = authContext.AcquireTokenAsync(
      serviceUrl, clientId, new Uri(redirectUrl), 
      new PlatformParameters(PromptBehavior.Always)).Result;
  </code></pre>
  
  <p>When I run this I getting a popup where I fill in my credentials and then it throws this error:</p>
  
  <pre><code>AdalException: {"error":"invalid_client","error_description":"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: xxx\r\nCorrelation ID: xxx\r\nTimestamp: 2018-06-28 10:17:20Z","error_codes":[70002],"timestamp":"2018-06-28 10:17:20Z","trace_id":"xxx","correlation_id":"xxx"}: Unknown error
  </code></pre>
  
  <p>I tried to add the client_secret by applying the change below but it still doesn't work</p>
  
  <pre><code>AuthenticationResult authResult = authContext.AcquireTokenAsync(
      serviceUrl, clientId, new Uri(redirectUrl), 
      new PlatformParameters(PromptBehavior.Always), UserIdentifier.AnyUser, 
      $"client_secret={clientSecret}").Result;
  </code></pre>
  
  <p>But when I run this it does work, but this is not what I want, I want to login with specific user.</p>
  
  <pre><code>AuthenticationResult authResult = authContext.AcquireTokenAsync(
      serviceUrl, new ClientCredential(clientId, clientSecret)).Result;
  </code></pre>