Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Getting access_token from C++ application (using trial)

Posted on by 15

Hi All

I have 30 days trial in Dynamics 365

I want to access Dynamics 365 api from my server application, this API:

https://docs.microsoft.com/en-us/dynamics-nav/api-reference/v1.0/index

I have created application in Microsoft Azure so I have client_id and client_secret I have also added Dynamic 365 user_impersonation rights in API Interface

I'm doing POST to:

with body:
client_id=my_client_id&client_secret=client_secret

I was trying with url encode setting header:
ContentTypeHeader,"application/x-www-form-urlencoded"

and without url encode

I'm getting reply:

The credentials provided are incorrect

Can someone provide an example or explanation how to request access_token without mouse clicking in Postman or similar application.

Best,
Marek

*This post is locked for comments

  • frankiPL Profile Picture
    frankiPL 15 on at
    RE: Getting access_token from C++ application (using trial)

    Hi All

    I have a bit of progress I'm doing POST to:

    login.windows.net/.../token

    with body:

    grant_type=client_credentials&client_id=my_client_id&client_secret=my_client_secret&resource=api.businesscentral.dynamics.com

    I'm getting response:

    {\"token_type\":\"Bearer\",\"expires_in\":\"3600\",\"ext_expires_in\":\"3600\",\"expires_on\":\"1561029308\",\"not_before\":\"1561025408\",\"resource\":\"api.businesscentral.dynamics.com\",\"access_token\":\"my_token_long_string\"}

    Then I want to get API list as described here:

    docs.microsoft.com/.../devenv-develop-connect-apps

    Using this access token

    GET api.businesscentral.dynamics.com/.../v1.0

    Authorization: Bearer my_access_token

    And in response I'm getting:

    <error xmlns=\"docs.oasis-open.org/.../metadata\"><code>NoLicense</code><message>User has no license</message></error>

    So is it possible to get access to API with trial version? Or is there something I'm doing wrong ?

    Best,

    Marek

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans