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

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Answered

How to get client id and secret for Oauth?

(0) ShareShare
ReportReport
Posted on by 10

I would like to connect to the Field Service API. I have a username and password for the webapp. How would I get a client id and secret in order to auth via OAuth2 ( which is required by the API)?  

Thanks.

I have the same question (0)
  • jrmcdona Profile Picture
    5 on at
    RE: How to get client id and secret for Oauth?

    Did you figure this out?  I have same issues.   Scope is not working for me here. I get 401

  • DotNetLarry Profile Picture
    5 on at
    RE: How to get client id and secret for Oauth?

    This is an old thread but did someone find an answer?

    Having the same problem when trying to get the an access token for Dynamics 365 Business Central api using MSAL.

    I get the token but get Unauhtorized -error when trying to call the api using the token. Graph api sample works fine so I'm suspecting the problem is with the scope, currently using "https://api.businesscentral.dynamics.com/.default" as scope.

  • rposadas Profile Picture
    10 on at
    RE: How to get client id and secret for Oauth?

    The docs lead me here: github.com/.../confidential_client_secret_sample.py

    Since I was using python and, from what I read, MSAL is replacing ADAL.  The sample code worked for me. But that was for the graph application. I am having issues with getting it to work with Field Service entities.

    Maybe, what I put for the “scope” and “endpoint” values are incorrect?

     "scope": [ "https://admin.services.crm.dynamics.com/.default" ]

     "endpoint": "https://<my_org>.crm.dynamics.com/api/data/v9.0/WhoAmI

    I am not getting a valid response when I do an HTTP GET with those value. Note, that I am getting a token back. But when I try to do a simple GET, I am get  None as a response which leads me to believe that the token I received was invalid.

  • Suggested answer
    ba365guy Profile Picture
    2,950 on at
    RE: How to get client id and secret for Oauth?

    In the above response, i mentioned an URL and a sample  ode is available in that URL. It's like your D365 Org. 

    Https://<yourcrmorg>.crm<i>.dynamics.com

    Did you try that sample

  • rposadas Profile Picture
    10 on at
    RE: How to get client id and secret for Oauth?

    Thank you.   I was able to register an application, get a client id and generate a client secret.

    How can I find what URL to hit to get the token? I can't seem to find it in the docs nor in the Azure AD.

  • Verified answer
    ba365guy Profile Picture
    2,950 on at
    RE: How to get client id and secret for Oauth?

    You have to create an "Application User" and register an app in Azure Active Directory. Please look in to the below link for detailed information.

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/authenticate-oauth

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Daniyal Khaleel Profile Picture

Daniyal Khaleel 67

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 28 Super User 2025 Season 2

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 17 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans