Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Get error when try to access Dynamics CRM entities in my application

Posted on by 10

I am planning to access Dynamics CRM entities in my flutter application, After getting client id and tenant from AZURE ACTIVE DIRECTORY, Now I need scope to access Dynamics CRM entities.

From PowerApp at the Developer resources I get Web API endpoint:

Screenshot_5F00_2022_2D00_01_2D00_11_5F00_11_2D00_57_2D00_46.png


This is my config:

Screenshot_5F00_2022_2D00_01_2D00_11_5F00_11_2D00_59_2D00_21.png

When I am trying to get token :

void login() async {
try {
await oauth.login();
String? accessToken = await oauth.getAccessToken();
print('------------> $accessToken');
} on Exception catch (e) {
print('------------> $e');
}
}

I got this error:

I/flutter ( 7460): ------------> Exception: Access denied or authentication canceled.

When I used `scope: "openid profile offline_access",` I received token. What is a problem ?

Even When I past `Web API endpoint` in browser I got :

This page isn’t workingIf the problem continues, contact the site owner.
HTTP ERROR 401

  • alt2020 Profile Picture
    alt2020 10 on at
    RE: Get error when try to access Dynamics CRM entities in my application

    There is no Token Part under Authentication, seems I have to make so in Token configuration  I choose to Add optional claim, After opening a modal I have to select the token type. I will select ID but int the lower list which token I have to select? Claim, acct,auth_time or ...?

    Is the right step?

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Get error when try to access Dynamics CRM entities in my application

    Hi,

    have you enabled ID Token under Authentication tab in App registration page?

    Please have a look at my blog -

    xrmdynamicscrm.wordpress.com/.../

    Also, in scope pass only base URL and remove /api/data/v9.2

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

  • alt2020 Profile Picture
    alt2020 10 on at
    RE: Get error when try to access Dynamics CRM entities in my application

    Screenshot_5F00_2022_2D00_01_2D00_11_5F00_13_2D00_28_2D00_27.png

    This is Api permissions and some part of  manifest: 

    	"acceptMappedClaims": null,
    	"accessTokenAcceptedVersion": null,
    	"addIns": [],
    	"allowPublicClient": true,
    	"appId": "e901ac4c-9b37-4ec8-ba87-c6703359404f",
    	"appRoles": [],
    	"oauth2AllowUrlPathMatching": false,
    	"createdDateTime": "2022-01-11T08:04:15Z",
    	"description": null,
    	"certification": null,
    	"disabledByMicrosoftStatus": null,
    	"groupMembershipClaims": null,
    	"identifierUris": [],

    But I still that error

  • Suggested answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: Get error when try to access Dynamics CRM entities in my application

    Hi,

    I hope you have selected Dynamics CRM User impersonation under Api permission in your Azure AD App registration.

    docs.microsoft.com/.../walkthrough-register-app-azure-active-directory

    Please mark my answer verified if this is helpful!

    Regards,

    Bipin Kumar

    Follow my Blog: xrmdynamicscrm.wordpress.com/

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