title: using Jwt-Dotnet to generate a valid token
body: <p>I am using the following code, which I borrowed originally from the <a href="https://github.com/jwt-dotnet/jwt" rel="nofollow noreferrer">jwt-dotnet github page</a></p>
  
  <pre><code>    private static string CreateToken(UserPrincipal principal)
      {
          /*
           * https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
           * http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html
           */
          var key = ConfigurationManager.AppSettings["jwt-key"];
  
          var claims = new Dictionary&lt;string, string&gt;()
          {
              {ClaimTypes.Name, "Rainbow Dash" },
              {ClaimTypes.WindowsAccountName, "RDash"}
          };
  
          var algorithm = new HMACSHA256Algorithm();
          var serializer = new JsonNetSerializer();
          var urlEncoder = new JwtBase64UrlEncoder();
          var encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
          var token = encoder.Encode(claims, key);
          return token;
      }
  </code></pre>
  
  <p>The above code generates the following token:</p>
  
  <blockquote>
    <p>eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiUmFpbmJvdyBEYXNoIiwiaHR0cDovL3NjaGVtYXMubWljcm9zb2Z0LmNvbS93cy8yMDA4LzA2L2lkZW50aXR5L2NsYWltcy93aW5kb3dzYWNjb3VudG5hbWUiOiJSRGFzaCJ9.5WZWDJ0pvTe6QLjVNUeTfZicX_wSsk1dtYvXUbpiOiw</p>
  </blockquote>
  
  <p>So, I hopped over to <a href="https://jwt.io/" rel="nofollow noreferrer">jwt.io</a> to test my token.  I'm told I have an invalid signature.</p>
  
  <p>How do I give it a valid 'signature'?  I don't understand what my JWT is missing.</p>