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

Announcements

No record found.

News and Announcements icon
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)
  • Verified answer
    ba365guy Profile Picture
    2,950 on at

    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

  • rposadas Profile Picture
    10 on at

    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.

  • Suggested answer
    ba365guy Profile Picture
    2,950 on at

    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

    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.

  • DotNetLarry Profile Picture
    5 on at

    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.

  • jrmcdona Profile Picture
    5 on at

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
11manish Profile Picture

11manish 36

#2
Mallesh Deshapaga Profile Picture

Mallesh Deshapaga 32

#3
ManoVerse Profile Picture

ManoVerse 30 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans