Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Able to use token generated from one resource in another for REST API requests

Posted on by Microsoft Employee

Hello,

I am integrating our product with dynamics 365.

For authorization, I am using 


with client_id, response_type, redirect_url, resource as parameters.

According to the docs, resource parameter is required which is the CRM instance URL, and without it, I am getting Unauthorized exception.

Now I created two CRM instances each associated with different accounts. Let's say,

user1 - user1.dynamics.com

user2 - user2.dynamics.com

Now, if I my browser is logged in to the credentials of user1, and I add the resource as "user2.dynamics.com", I am still getting a proper token. But through this token, I am unable to access the data of user2.dynamics.com (which is the url user1 gave as crm instance url when he added his account to my website). But I am able to access the data of user1.dynamics.com (the original instance url of the user who was logged in - user1).

How is this correct? Why is a token being generated for a wrong instance url being given as resource? What is the purpose of this resource parameter? And if the resource can be given as any working instance url, then is there a way to find out the original instance url of the user who has logged in. For this I tried the discovery service, but it lists all the instances the user is part of and there is no way to find out which is the one he is trying to connect without asking the user again (which brings me back to the original problem of asking the user to enter the instance url and he enters a different one and token is generated which gives unauthorized error).

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Able to use token generated from one resource in another for REST API requests

    Any ideas?

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans