Skip to content

Instantly share code, notes, and snippets.

@neoeinstein
Created December 14, 2015 21:03
Show Gist options
  • Save neoeinstein/c4e5ac848d82734636c6 to your computer and use it in GitHub Desktop.
Save neoeinstein/c4e5ac848d82734636c6 to your computer and use it in GitHub Desktop.
// Your location of the Jwt source
#I @"packages/System.IdentityModel.Tokens.Jwt/lib/net45"
#r "System.IdentityModel.Tokens.Jwt.dll"
#r "System.IdentityModel"
open System.IdentityModel.Tokens
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImV4cCI6MTU3NzgzNjgwMCwiaXNzIjoiSVNTVUVSIiwiYXVkIjoiQVVESUVOQ0UifQ.POsywz2VWFrISYj8PBFaeOsPMqaEaQIOJ1eZyaM9JsA"
let secretSecurityKey = InMemorySymmetricSecurityKey(System.Text.Encoding.UTF8.GetBytes("secret\000\000\000\000\000\000\000\000\000\000"))
let tokenParams = TokenValidationParameters(IssuerSigningKey = secretSecurityKey,ValidAudience="AUDIENCE",ValidIssuer="ISSUER")
let handler = JwtSecurityTokenHandler()
handler.ValidateToken(token,tokenParams)
// Win
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment