Created
March 4, 2020 13:29
-
-
Save AnnejanBarelds/3cbb98635229c95669d9f17735372281 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private string GetJwtTokenProof(X509Certificate2 signingCert, string appId) | |
{ | |
var notBefore = DateTime.Now; | |
var expires = notBefore.AddMinutes(10); | |
var handler = new JwtSecurityTokenHandler(); | |
var credentials = new X509SigningCredentials(signingCert); | |
var jwtToken = handler.CreateJwtSecurityToken(appId, "https://graph.windows.net", null, notBefore, expires, null, credentials); | |
return handler.WriteToken(jwtToken); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment