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 :
Microsoft Dynamics CRM (Archived)

Where we can add Access token URl,Client Id and Client Secret in crm 365.

(0) ShareShare
ReportReport
Posted on by

Hi guys,

I want [Authorize] the user who could be hit my external  web api from crm 2016.

Question:-

1 . where we can put all the secret ids like:- Access token URl,Client Id and Client Secret .

2.  How get Access token through java script.

Note:- I using external web Api.  My Keys:- 

Auth URL :- xyz.azurewebsites.net/identity

Access token URl :- xyz.azurewebsites.net/.../token

Client Id:- abc

Client Secret :- xyz-abc-frt

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Please help me out :(

  • Suggested answer
    prt33k Profile Picture
    6,907 on at

    Please go thorugh this : msdn.microsoft.com/.../mt595797.aspx

    In the section 'Register the Application' it provide details you need.

    Basically you need to register your web app in AAD. This will give you App ID and Client ID.

    You can then pass the clientID from you registered App to get authenticated/

    Thanks,

    Prateek

  • Community Member Profile Picture
    on at

    Thanks Prateek !

    I have paste the Code blow for Access Token when any user hit my web-api.

    This code not return any access token. I used all the Credentials in Postman tool , its return the token.  Please check once .

    function loadValidation() {

       var key;

       var token_ // variable will store the token

       var clientID = "xyz"; // app clientID

       var clientSecret = "abcd"; // app clientSecret

       var url = "xyzabc.azurewebsites.net/.../token"; // Your application token endpoint  

       var request = new XMLHttpRequest();

       request.open("POST", url, true);

       request.setRequestHeader("Content-type", "application/json");

       request.setRequestHeader("Accept", "application/json");

       request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

       request.setRequestHeader("Access-Control-Allow-Headers", "*");

       request.setRequestHeader('Access-Control-Allow-Credentials', true);

       request.setRequestHeader('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');

       request.send("grant_type=client_credentials&client_id=" + clientID + "&" + "client_secret=" + clientSecret + "&audience=serviceapi"); // specify the credentials to receive the token on request

       request.onreadystatechange = function () {

           if (request.readyState == request.DONE) {

               var response = request.responseText;

               var obj = JSON.parse(response);

               key = obj.access_token; //store the value of the accesstoken

               token_ = key; // store token in your global variable "token_" or you could simply return the value of the access token from the function

           }

       }

    }

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans