# JWT token creation in asp.net

**URL:** <https://devforum.zoom.us/t/jwt-token-creation-in-asp-net/20421>\
**Category:** API and Webhooks\
**Created:** [June 5, 2020, 8:24am UTC](https://devforum.zoom.us/t/jwt-token-creation-in-asp-net/20421 "2020-06-05T08:24:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sv003](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sv003](https://devforum.zoom.us/u/sv003)\
**Post date:** [June 5, 2020, 8:24am UTC](https://devforum.zoom.us/t/jwt-token-creation-in-asp-net/20421/1 "2020-06-05T08:24:51Z")

</div>

**Description**  
Create token in [asp.net](http://asp.net) using JWT,

**Error**  
Invalid Token

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
JWT

**Which Endpoint/s?**  
How to create Zoom Token to create meeting using JWT authentication,

**How To Reproduce (If applicable)**  
Steps to reproduce the behavior:  
Please find the code below iam using

```
       string key = "xxxxxxxxxxxxxxxx";
       // Create Security key using private key above:
       // not that latest version of JWT using Microsoft namespace instead of System
       var securityKey = new Microsoft
           .IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(key));

       // Also note that securityKey length should be >256b
       // so you have to make sure that your private key has a proper length
       //
       var credentials = new Microsoft.IdentityModel.Tokens.SigningCredentials
                         (securityKey, SecurityAlgorithms.HmacSha256Signature);
       var header = new JwtHeader(credentials);
       var exp = "1516239022";
       // Finally create a Token
        Header = "{\"alg\":\"HS256\",\"typ\":\"JWT\"}";
       var Payload1 = new JwtPayload
       {
           { "iss ", "xxxxxxxx"},
           { "exp", "1516239022"},
       };
       

        var secToken = new JwtSecurityToken(header, Payload1);
        var handler = new JwtSecurityTokenHandler();

        // Token to String so you can use it in your client
        var tokenString = handler.WriteToken(secToken);

        Console.WriteLine(tokenString);
        Console.WriteLine("Consume Token");

        // And finally when you received token from client
        // you can either validate it or try to read
        var token = handler.ReadJwtToken(tokenString);

```

**Additional context**  
Can you please provide any sample to generate JWT. We created the JWT successfully using [https://jwt.io/](https://jwt.io/) but getting invalid token when we integrate in our code base

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [June 11, 2020, 6:23pm UTC](https://devforum.zoom.us/t/jwt-token-creation-in-asp-net/20421/2 "2020-06-11T18:23:52Z")

</div>

Hey @sv003,

Please use one of the libraries from [jwt.io](http://jwt.io). Just scroll down to see the list of libraries.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 10:00pm UTC](https://devforum.zoom.us/t/jwt-token-creation-in-asp-net/20421/3 "2020-08-21T22:00:03Z")

</div>

Closed on August 21, 2020, 10:00pm UTC


