OData web service endpoint with OAuth2

mbauer513
Member Posts: 1
In a BC Cloud demo environment, I'm trying to call an OData web service using OAuth2 bearer token. It's working when calling a service based on a standard BC page, but not when calling a service based on a page added in an extension.
I'm able to get the token. Like I said, the OData call works fine if it's for a standard NAV page. I made an entry (named TaxGroupTest) in Web Services for page 467, Tax Groups. I checked Publish so that the web service is active.
Using REST Client in Visual Studio Code, I made a Get request to the OData service:
GET api.businesscentral.dynamics.com/v2.0/385c4a01-a86f-4a0c-8693-############/Sandbox/ODataV4/Company('CRONUS%20USA%2C%20Inc.')/TaxGroupTest HTTP/1.1
Authorization: Bearer {{auth.response.body.$.access_token}}
Content-Type: application/json
It worked. It sent back the list of Tax Group records in BC.
I created an extension for a new page with ID in 50000 range, based off the same table (Tax Group). I made another entry in Web Services for this new page and called the service TaxGroupTest2.
Here is the Get request for this service:
GET api.businesscentral.dynamics.com/v2.0/385c4a01-a86f-4a0c-8693-############/Sandbox/ODataV4/Company('CRONUS%20USA%2C%20Inc.')/TaxGroupTest2 HTTP/1.1
Authorization: Bearer {{auth.response.body.$.access_token}}
Content-Type: application/json
However, this request fails and returns the following error message:
"You do not have access to this object using an application as authentication."
In Azure Active Directory, I gave all permissions that would seem relevant: API.ReadWrite.All, app_access, Automation.ReadWrite.All, Financials.ReadWrite.All. I granted admin consent. In BC, I created an entry in table AAD Application, and added permission sets D365 Automation, Exten. Mgt. - Admin, and Super. So, I'm not sure what else I can do from a permissions standpoint.
Has anybody else experienced this issue? Is this somehow related to licensing issues that Microsoft is still working out? We are working on a new integration and I would prefer not to use Basic Authentication, as it will be deprecated next year.
Thank you
I'm able to get the token. Like I said, the OData call works fine if it's for a standard NAV page. I made an entry (named TaxGroupTest) in Web Services for page 467, Tax Groups. I checked Publish so that the web service is active.
Using REST Client in Visual Studio Code, I made a Get request to the OData service:
GET api.businesscentral.dynamics.com/v2.0/385c4a01-a86f-4a0c-8693-############/Sandbox/ODataV4/Company('CRONUS%20USA%2C%20Inc.')/TaxGroupTest HTTP/1.1
Authorization: Bearer {{auth.response.body.$.access_token}}
Content-Type: application/json
It worked. It sent back the list of Tax Group records in BC.
I created an extension for a new page with ID in 50000 range, based off the same table (Tax Group). I made another entry in Web Services for this new page and called the service TaxGroupTest2.
Here is the Get request for this service:
GET api.businesscentral.dynamics.com/v2.0/385c4a01-a86f-4a0c-8693-############/Sandbox/ODataV4/Company('CRONUS%20USA%2C%20Inc.')/TaxGroupTest2 HTTP/1.1
Authorization: Bearer {{auth.response.body.$.access_token}}
Content-Type: application/json
However, this request fails and returns the following error message:
"You do not have access to this object using an application as authentication."
In Azure Active Directory, I gave all permissions that would seem relevant: API.ReadWrite.All, app_access, Automation.ReadWrite.All, Financials.ReadWrite.All. I granted admin consent. In BC, I created an entry in table AAD Application, and added permission sets D365 Automation, Exten. Mgt. - Admin, and Super. So, I'm not sure what else I can do from a permissions standpoint.
Has anybody else experienced this issue? Is this somehow related to licensing issues that Microsoft is still working out? We are working on a new integration and I would prefer not to use Basic Authentication, as it will be deprecated next year.
Thank you
0
Answers
-
Did you find a solution to this?Hello IT, have you tried to turn it off and on?
Have you checked the cables?
Have you released the filters?
http://www.navfreak.com0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions