Getting Access Token in SharePoint Server Subscription Edition

New Contributor

Hi All,


In SharePoint Online I am using the below code to get the token and using the same token info to perform various Rest API operations like Retrieving list items in the List  etc.   


I want to do the same thing in SharePoint Server Subscription Edition, I am not sure about the oAuth Url I should use or any other way i can get it like  I  used this endpoint***********/tokens/oauth/2/ in Online. Any suggestions?


var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("grant_type", "client_credentials");
urlencoded.append("client_id", "***********");
urlencoded.append("client_secret", "*******");
urlencoded.append("resource", "00000003-0000-0ff1-ce00-000000000000/*******");

var requestOptions = {
method: 'GET',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'

fetch("***********/tokens/oauth/2/", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

1 Reply
Hi, I guess you are talking about how to do app authentication with SharePoint Server. You can reference to