Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

ODATA SERVICE Authentication Issue / Accessing Entity Data

(0) ShareShare
ReportReport
Posted on by

Hi all,

I'm currently using the Dynamics Github Service Examples to see if I could consume the OData end points.  I'm currently having an issue where I'm trying to enumerate through the returned data set but i'm reaching an exception where it gives me a status code of 403 unauthorized.  

Does anyone know what might be causing that?  I'm thinking I'm missing a setting or something.  

Other pertinent info:

The app is registered in AAD as a Web App / API.  I've given it the following permissions:

Microsoft Dynamics ERP

- Delegated Permissions:  all 3

Windows Azure Active Directory

- Delegated Permissions: only 1 - Sign in and Read user Profiles

I'm passing through a set of credentials as well as the client key.

Not sure what i'm missing but i would be eternally grateful if someone could give me some hints as to what i'm missing.

Thank you!

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    Hi,

    I have system admin permission. I can see that option when application is "web api", but when application is "native" , I cannot see that option (as i want to use native app).

    Moreover,But when I use an Web API app, when I click the grant permission button i got below error.

    {"errorCode":"Authorization_RequestDenied","localizedErrorDetails":{"errorDetail":"This application requires application permissions to another application. Consent for application permissions can only be performed by an administrator. Sign out and sign in as an administrator or contact one of your organization's administrators."}

    Thanks,

    Amit Baghel

  • tek9iner Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    The three you can find seem to be the ones listed under Delegated Permissions.  The Access Dynamic Connector Service APIs permission should be under "Application Permissions" as shown below.  If you can't find that permission, then it might be a permissions or system related issue but I'm completely guessing on that last point.  By chance, do you have admin permissions?

    Screen-Shot-2018_2D00_07_2D00_02-at-9.45.37-PM.png

  • Community Member Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    Hi,

    I am also facing the same issue, but I cannot see all for permission under as shown below.

    Microsoft Dynamics ERP

    -  Access Dynamics Connector Service APIs

    -  Access Dynamics AX online as organization users

    - Access Dynamics AX Data

    -  Access Dynamics AX Custom Service

    I can only see below three.

    -  Access Dynamics AX online as organization users

    - Access Dynamics AX Data

    -  Access Dynamics AX Custom Service

    How can I see the "Access Dynamics Connector Service APIs", I am facing the same issue.

    Please help me fast I am also facing the same issue.Its very urgent.

    Thanks,

    Amit Baghel

  • tek9iner Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    For step 1, I logged into portal.azure.com and then clicked on azure active directory and then went to app registrations.  If you dont have an app registered, you will need to create one.  From there you should see a permissions tab where you can set what you need.

  • Community Member Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    How did you complete step 1?

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    Awesome!!

    I was facing same issue since couple of days. I was missing same setting up azure active directory in dynamics

    Thanks

    Nutan

  • Martin Dráb Profile Picture
    231,923 Most Valuable Professional on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    Sorry, I overlooked your reply on 11.5. For others, this approach is explained in Service to Service authentication in AX7.

  • Verified answer
    tek9iner Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    Found the answer to my problem in case anyone comes across a similar issue:

    Two issues were discovered with my setup:

    1.  I was missing one permission for Microsoft Dynamics ERP, Access Dynamics Connector Service APIs.

    My final permissions are below:

    Microsoft Dynamics ERP

    -  Access Dynamics Connector Service APIs

    -  Access Dynamics AX online as organization users

    - Access Dynamics AX Data

    -  Access Dynamics AX Custom Service

    2.  Final issue with my setup was that I didn't register the Web APP / API with Dynamics 365.

    In order to do that I went to the following screen within my Dynamics instance:

    System Administration > Setup > Azure Active Directory Applications   (you can also search for it, thats how i found it)

    Click the +New button to add a new registration.  

    Grab the Application ID from the registration in the Azure Portal and insert it into the Client ID field.

    Fill out the rest of the fields as necessary.

    After that I was able to access the OData end points from my app.

  • tek9iner Profile Picture
    on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    Hi Martin,

    I am passing through an App ID and a Client Secret for an application registered as a Web App / API in Azure AD.  

    I can see the authorization token being passed through.  It's only when I try to perform any action on an odata entity is when I receive the 403 forbidden error.

    Here's the error I get when debugging the console application:

    "{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"Forbidden\",\"ExceptionType\":\"System.ServiceModel.Web.WebFaultException`1[[System.ComponentModel.Win32Exception, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]\",\"StackTrace\":\"   at Microsoft.Dynamics.Ax.Services.ServicesSessionProvider.ThrowSessionCreationException(ServicesSessionCreationErrorCode exceptionCode)\\r\\n   at Microsoft.Dynamics.Ax.Services.ServicesSessionProvider.GetSession(Boolean isILSession, Boolean bypassAuthentication, String issuer, String company, String language, String partitionKey, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Ax.Services.ServicesSessionManager.InitThreadSession(Boolean ilSession, SessionType sessionType, Boolean bypassAuthentication, String authIssuer, String company, String language, String partitionKey, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.ServicesAosSessionManager.InitializeSession(Boolean bypassAuthentication, String authIssuerThumbprint, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.OwinRequestSessionProvider.CreateSession(ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.ServicesRequestSessionHelper.EnsureRequestSession(IServicesRequestSessionProvider servicesRequestSessionProvider, ClaimsIdentity claimsIdentity)\\r\\n   at Microsoft.Dynamics.Platform.Integration.Common.SessionManagement.EnsureServicesRequestSessionHandler.EnsureServicesRequestSession(HttpRequestMessage request, IApplicationEnvironment applicationEnvironment)\"}"

  • Suggested answer
    Martin Dráb Profile Picture
    231,923 Most Valuable Professional on at
    RE: ODATA SERVICE Authentication Issue / Accessing Entity Data

    Please tell us what credentials you're using. If you want to use username and password, you have to register your app as a native app. Web apps use ActiveDirectoryClientAppSecret.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,202 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans