I have created a azure web api using adal-node authentication context and a angularjs application, jwt token(access token) has been passed through the angularjs application in order to call the web API. I need to verify the user from jwt token before allowing the user to access the web API. How can I do this jwt verification using adal-node authentication context.
sample code for generating the access token
function getToken(TENANT) {
var promise = new Promise(function (resolve, reject) {
try {
//const authContext = new adal.AuthenticationContext(`https://login.microsoftonline.com/${TENANT}`);
const authContext = new adal.AuthenticationContext('https://login.microsoftonline.com/'+TENANT);
authContext.acquireTokenWithClientCredentials(GRAPH_URL,CLIENT_ID,CLIENT_SECRET,function(err,tokenRes)
{
if (err)
{
reject(err);
}
var accesstoken = tokenRes.accessToken;
resolve(accesstoken);
})
}
catch (ex) {
reject(ex);
};
});
return promise;
}