Using the code in the Module 'Query Microsoft Graph by using SDKs' with a simple .Net console app and I ran into an error.

Kebede, Hallelujah (Reigate) 0 Reputation points
2024-05-06T15:13:13.7233333+00:00

.Net console application

Task : Setting up a Microsoft Graph client

Code : As presented in the module

Error : A configuration issue is preventing authentication - check the error message from the server for details. You can modify the configuration in the application registration portal. See https://aka.ms/msal-net-invalid-client for details. Original exception: AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.

This question is related to the following Learning Module

Azure Training
Azure Training
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Training: Instruction to develop new skills.
1,313 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. SiddeshTN 3,520 Reputation points Microsoft Vendor
    2024-05-06T17:01:12.1+00:00

    Hi Kebede, Hallelujah (Reigate),

    Thank you for reaching out to Microsoft Q & A forum.

    I understand that you're encountering the error message below. To hopefully assist you in finding the right direction or resolving your issue, I'll share my findings with you.

    Error Message:

    AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.
    **
    Findings:**

    Based off your error code - AADSTS7000218, I found some Stack Overflow threads and internal issues relating to your error message, and this could be due to the wrong App Registration default client type being used.

    Confidential clients utilize the Client Credentials flow, Authorization Code flow, and On-Behalf-Of flow to request a token. Azure AD will return the mentioned error if the request lacks a client secret or client assertion.

    To resolve this, follow these steps:

    1. Navigate to your Azure AD App Registration.
    2. Select Authentication.
    3. Modify "Allow public client flows" to "Yes".

    User's image

    I hope this helps!

    Please feel free to contact us if you have any additional questions.

    If you've found the provided answer helpful, please click the "Accept Answer/Upvote" button. This will be beneficial to other members of the Microsoft Q&A forum community.

    Thank you.

    1 person found this answer helpful.
    0 comments No comments