web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Authenticate twice for Web API and Organization URL - Using REST ?

(0) ShareShare
ReportReport
Posted on by 5

I'm trying to read customer data from any user who has dynamics CRM account.

First step, I'm using the below url to get the access token for retrieving the organization url for the user. It shows the consent and asks for credentials. Response will have the organization url.

login.microsoftonline.com/.../authorize`+
Second step, to retrieve the data, it is advised to use the organization url and authorize as below.
`login.microsoftonline.com/.../authorize`+
`?resource=`+<organization from first step> 
It would give the access token needed to retrieve the data.
My question is, it is prompting for user authentication twice, in both steps. Is it possible to let the second step use the same credentials as the first one. 
Thanks for your help in advance,
Sreelatha
I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    Yes it is possible to interact with CRM web api using access token which you have obtained from first step without user interaction and they will not have to enter their credentials again.

    Pass Access Token in header as Bearer.

    var myHeaders = new Headers();
    myHeaders.append("Accept", "application/json");
    myHeaders.append("Content-Type", "application/json; charset=utf-8");
    myHeaders.append("Prefer", "odata.maxpagesize=2");
    myHeaders.append("Prefer", "odata.include-annotations=\"*\"");
    myHeaders.append("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSIsImtpZCI6IllNRUxIVDBndmIwbXhvU0RvWWZvbWpxZmpZVSJ9.eyJhdWQiOiJodHRwczovL21tZGV2LmNybS5keW5hbWljcy5jb20iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC8wOTVmMDk3Ni1iZjY2LTRkNzYtYmYyOS0wZmJhYjA4ODRlY2IvIiwiaWF0IjoxNTg2MDA4NTc1LCJuYmYiOjE1ODYwMDg1NzUsImV4cCI6MTU4NjAxMjQ3NSwiYWlvIjoiNDJkZ1lMRFZ1Sk1UcEhqY2I4ZU8yb3ViYzZkK0FnQT0iLCJhcHBpZCI6ImRiYmZlZDAzLTUwMjMtNDEwYi1iNTg4LThkYjcwYTYxYzhhZiIsImFwcGlkYWNyIjoiMSIsImlkcCI6Imh0dHBzOi8vc3RzLndpbmRvd3MubmV0LzA5NWYwOTc2LWJmNjYtNGQ3Ni1iZjI5LTBmYmFiMDg4NGVjYi8iLCJvaWQiOiI2MTgyMTgzOS0xZWUwLTQwOGUtOTk3ZC1mYjE1OGY0Yzk2ODYiLCJzdWIiOiI2MTgyMTgzOS0xZWUwLTQwOGUtOTk3ZC1mYjE1OGY0Yzk2ODYiLCJ0aWQiOiIwOTVmMDk3Ni1iZjY2LTRkNzYtYmYyOS0wZmJhYjA4ODRlY2IiLCJ1dGkiOiIzd0ZneGl1VWpFYS1BdmJ1TW1NT0FBIiwidmVyIjoiMS4wIn0.S4Ao6bX9WkdIUMNcLNFyCxq3hF1jx8J_4gS4izO9jOpPzFuynyq8j3pPeqBc_6Dh-IzLu5OFIH2agol6rmZ1rlLEDi5zXQKwYvTKkKUgQZQlRLzWaIIYtQIYOReYwj6NEjfOQb6tufqGYdAVsIlJVcVqWHkfrSbsyQdoUZBObE3t-9vGUVYM-p0mFUEUYoiNzr-wKLtXrsc14Zt5aclvQmnQrt-4JVZnjOt5mSGj7PWZl5gdhLkXPYoRQhcBsMC777aqVr3o5EaZTmUJh482eQjDOMj8pGq3wipQPOZ1UKOkc6QBHqI78rObmzT-mrRP73yqNcdIe9H8jNdPgPGnyQ");

    If found helpful, Please mark my answer verified.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 37

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans