Authentication issue while using Client Credential through Oauth2.0

Vatan Jain 0 Reputation points
2025-01-14T19:54:21.7266667+00:00

Hi Community
Hope you are doing well.
I am unable to authenticate to our registered app in azure. I am looking to test the get/users graph api using insomnia (similar tool as postman). During Token generation we are getting 401 error. we are provide correct Client ID and Secret with right scope url.

I created the app, added the necessary permissions and the client credentials. Do I need to add a redirect uri to the app? Does the app need to be registered account types as "accounts in any organization directory"?

I am getting a 401 unauthorized error

Error: {"error":"task failed: activity error (type: sp:external:http:v2, scheduledEventID: 11, startedEventID: 12, identity: 1@sp-workflow-worker-stg-us-east-1-5c7556fb48-dc6zw@): request failed (type: HTTP Response Returned a Client Error, retryable: false): request failed: 401 - 401 Unauthorized - {"error":{"code":"InvalidAuthenticationToken","message":"ArgumentNull","innerError":{"date":"2025-01-09T16:51:54","request-id":"2c65c375-5aeb-4cd9-aafc-ab1ee13d1de3","client-request-id":"2c65c375-5aeb-4cd9-aafc-ab1ee13d1de3"}}}"}

Can you please assist what I'm what is missing here? I will really do appreciate your help.

Thanks
Vatan 

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,016 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,265 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yakun Huang-MSFT 9,780 Reputation points Microsoft Vendor
    2025-01-15T02:02:40.92+00:00

    Hello Vatan Jain,

    Thank you for reaching out to Microsoft Support!

    Yes, you need to Add a redirect uri to your application. Please click Add a platform in Authentication and select web to add the uri. More details can be found in the link, as shown in the following picture:

    User's image

    You can select a registered account type based on your requirements. For details, refer to this document.

    For obtaining tokens refer to this document, it should be noted that administrator consent is required for granted permissions, as shown below:

    User's image

    Here are our test results, you can refer to:

    Screenshot 2025-01-15 020107

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.