web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to use Discovery S...
Power Apps
Unanswered

How to use Discovery Service API.

(0) ShareShare
ReportReport
Posted on by 36

I would like to use the Discovery Service API, but even after referring to the following site, it does not work.

As a result, I get a Status 401 Unauthorized response.

https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/discovery-orgsdk-to-webapi

 

See the images below for Request and Response.

名称未設定 1.png

 

名称未設定 2.png

 

名称未設定 3.png

 

I followed the steps below with reference to MS Learn.

https://docs.microsoft.com/en-us/learn/modules/common-data-service-web-api/

 

  1. Register Dataverse App to Azure AD
  2. Modify Manifest in Microsoft CRM Portals
  3. Allow API access
  4. Generate OAuth 2.0 Access Token by Postman.
  5. Execute the WhoAmI function to check the Web API connection to Dataverse, and confirm that the response is Status 200 OK.
  6. As a result of executing the Discovery Service API, the status 401 Unauthorized was response.

 

Please let me know if I am missing some setting or if it is a tenant problem.

 

Thank you for help.

 

 

I have the same question (0)
  • v-xiaochen-msft Profile Picture
    on at

    Hi @Go_Ozeki ,

     

    Their resources are different.

    vxiaochenmsft_0-1627608685668.png

    https://login.microsoftonline.com/common/oauth2/authorize?resource=https://globaldisco.crm.dynamics.com

    vxiaochenmsft_1-1627608709737.png

     

    Get its token and use it.

    vxiaochenmsft_2-1627608760312.png

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

     

  • Go Ozeki Profile Picture
    36 on at

    Hi @v-xiaochen-msft,

     

    I changed the AuthURL to the one you gave me, got the token, and tried again.
    However, the result was the same: 401 Unauthorized.
    What are the possible reasons for the 401 Unauthorized?

     

    Thank you.

     

    Go_Ozeki_0-1627622944588.png

    Go_Ozeki_1-1627622949055.png

    Go_Ozeki_2-1627622954097.png

     

  • v-xiaochen-msft Profile Picture
    on at

    Hi @Go_Ozeki ,

     

    Have you given your application enough permissions?

    vxiaochenmsft_0-1627625120192.png

    vxiaochenmsft_2-1627625184843.png

     

    vxiaochenmsft_1-1627625172172.png

    vxiaochenmsft_3-1627625201425.png

    vxiaochenmsft_4-1627625222024.png

    vxiaochenmsft_5-1627625233035.png

    vxiaochenmsft_6-1627625271103.png

    vxiaochenmsft_7-1627625319411.png

     

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

     

  • Go Ozeki Profile Picture
    36 on at

    Hi @v-xiaochen-msft,


    I do not have permissions to work with Azure AD.
    I will check with my system administrator later or get a developer subscription and try it out.

    Thank you for help.

  • Go Ozeki Profile Picture
    36 on at

    Hi @v-xiaochen-msft,

    I got a developer subscription and tried the following steps.

     

    1.Granted admin consent for my Environment.

    Go_Ozeki_0-1627892710028.png

    Go_Ozeki_1-1627892710033.png

     

    2.Configured the Manifest.

    Go_Ozeki_2-1627892729046.png

    Go_Ozeki_3-1627892729048.png


    3.Authentication was set to Multitenant.

    Go_Ozeki_4-1627892747603.png


    4.Postman settings.

    Go_Ozeki_5-1627892765743.png

    Auth URL:

    https://login.microsoftonline.com/common/oauth2/authorize?resource=https://globaldisco.crm.dynamics.com

     

    However, the result was the same: 401 Unauthorized.
    Do I still need to configure something?

    Go_Ozeki_6-1627892966287.png

     

    Thank you for help.

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @Go_Ozeki ,

     

    Is the permission of the app now the same as in the image?

    vxiaochenmsft_0-1627893899986.png

     

    Please check if your postman has selected the correct environment and check if your client id and callback are correct.

     

    vxiaochenmsft_1-1627894117602.png

    vxiaochenmsft_2-1627894225240.png

    vxiaochenmsft_3-1627894310124.png

    vxiaochenmsft_4-1627894696999.png

    vxiaochenmsft_5-1627894715066.png

    vxiaochenmsft_6-1627894761889.png

     

    // Please use Bearer 

    vxiaochenmsft_7-1627894830495.png

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

     

     

  • ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @Go_Ozeki,

     

    In the 401 response, there should be header called www-authenticate, which should give you a clue as to what resource you need to specify when requesting access.

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

  • Go Ozeki Profile Picture
    36 on at

    Hi @v-xiaochen-msft,

     

    I set the Header Prefix to "Bearer" and got the results fine!
    All settings except Header Prefix were set as you said.

    Go_Ozeki_0-1628070014333.png

     

    I am very grateful for all the advice you have given me.

    Thank you for help.

     

  • Go Ozeki Profile Picture
    36 on at

    Hi @ChrisPiasecki,

     

    I checked the www-authenticate and found the following statement, but I couldn't read that setting the Header Prefix to "Bearer" would solve the problem.

    Bearer authorization_uri=https://login.microsoftonline.com/common/oauth2/authorize,resource_id=https://globaldisco.crm.dynamics.com/

     

    But your advice was very helpful!

    Thank you for help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard