Reputation: 4260
I was able to obtain a JWT token successfully using MSAL pattern from Graph API per the following code snippet below in C#:
app = ConfidentialClientApplicationBuilder.Create(_authenticationSettings.ClientId)
.WithClientSecret(_authenticationSettings.ClientSecret)
.WithAuthority(new Uri(_authenticationSettings.Authority))
.Build();
var result = await app.AcquireTokenForClient(scopes).ExecuteAsync();
return result.AccessToken;
I am also able to include this token in POST or GET requests' headers as a "Bearer" token to submit to an HTTP-triggered function. How can I validate this token in the function side to ensure it's authentic? All examples online are covering asp.net core applications and I could not find anything relevant to functions.
Upvotes: 0
Views: 1396
Reputation: 20595
Here you can find a tutorial how to validate Graph API token in Azure Functions.
JwtSecurityTokenHandler class is used for validating JWT.
Upvotes: 2