I have a REST API (build in Node.js) hosted Azure functions secured with Microsoft Azure Active Directory.
I also have a Javascript application hosted in Sharepoint Framework (Sharepoint online) and I want to do an Ajax call from the application to my custom API like this:
$.ajax({
url: 'https://xxxxx.azurewebsites.net/api/xxxxx',
method: "GET",
dataType: "json",
headers: {
"accept": "application/json;odata=verbose",
"Authorization": "Bearer " + token
},
success: function(data) {
What I need is a token. Can I use the new PKCE MSAL 2.0 for single page apps to get the token? Or do I still need to use MSAL 1.0 with implicit grant flow? Does anyone has an example in javascript to get a token to access an Azure API made in functions?
Or has someone an idea how I can get the token? This way I found but it's the old way: Consume Secure Azure API from SharePoint online