Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested answer

Getting a 403 when trying to access a Field Service resource

(0) ShareShare
ReportReport
Posted on by 10

I am getting a 403 when I try to manage entities in the Field Service app via API.

I am getting a token like so:

authority_url = "">login.microsoftonline.com/<my_tenant>"
client_id = '<client_id>'
client_secret = '<client_secret>'
resource = 'https://<my_org>.crm.dynamics.com'

context = AuthenticationContext(authority_url, validate_authority=None, cache=None, api_version=None, timeout=None, enable_pii=False)

token = context.acquire_token_with_client_credentials(resource, client_id, client_secret)

return token['accessToken']


I am trying to hit the “WhoAmI” endpoint indicated here: docs.microsoft.com/.../gg334767(v=crm.8)

url = 'https://<my_org>.crm.dynamics.com/api/data/v9.0/WhoAmI'
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer {0}'.format(token)} # token from the previous call above.
r = requests.get(url, headers=headers)

At this point I get an HTTP response of 403.

It looks like I get authenticated correctly, but I am not getting authorized. How would I go about fixing this? Does my code look correct?

I gave my registered app permission to "Dynamics CRM". But that didn't work.

Any advice?

  • rposadas Profile Picture
    rposadas 10 on at
    RE: Getting a 403 when trying to access a Field Service resource

    Thanks for the link.

    I'm curious, the docs walks me through creating a user.   I already have a user that has admin rights. Would I need to create another one?

    I registered the app, gave it permissions and currently have a user in the user list with admin rights. Wouldn't that be enough?

    Would there be another reason why I'm getting a 403 besides the lack of a registered app which I have?

  • Gilmeyer Profile Picture
    Gilmeyer on at
    RE: Getting a 403 when trying to access a Field Service resource

    Correct link URL - community.dynamics.com/.../dynamics-365-online-authenticate-with-client-credentials

  • rposadas Profile Picture
    rposadas 10 on at
    RE: Getting a 403 when trying to access a Field Service resource

    Thanks for the reply.

    I registered an app on the dynamics side. I did that by going to the Azure Portal (https://portal.azure.com) and then the "App Registation" page. Is that the same as creating an application user?

    Also, that link is broken for me.

  • Suggested answer
    Gilmeyer Profile Picture
    Gilmeyer on at
    RE: Getting a 403 when trying to access a Field Service resource

    Hi ,

    Have you created the application users on the Dynamics side?

    Please refer to community.dynamics.com/.../dynamics-365-online-authenticate-with-client-credentials.

    Thanks

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,403 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans