Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created January 28, 2021 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/683b31383f46de2d0d8aa77555a116dc to your computer and use it in GitHub Desktop.
Save bjoerntx/683b31383f46de2d0d8aa77555a116dc to your computer and use it in GitHub Desktop.
function getAccessToken(callback) {
$.ajax({
type: "POST",
headers: {
"Authorization": "Basic " + btoa(m_clientID + ":" + m_clientSecret)
},
url: m_serviceURL + "/OAuth/Token",
data: {
"grant_type": "client_credentials"
},
success: successFunc
});
function successFunc(data, status) {
if (typeof callback == "function") {
callback(data.access_token);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment