I am attempting to create a zoom meeting using C# with JWT authentication.
I can create a meeting using Postman but struggling through my code.
I am getting an empty response back and no meeting is created.
[WebMethod]
public String AddZoomMeetingLink(String b)
{
var tokenHandler = new System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler();
var now = DateTime.UtcNow;
var apiSecret = "mysecret";
byte[] symmetricKey = Encoding.ASCII.GetBytes(apiSecret);
var tokenDescriptor = new Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor
{
Issuer = "myapikey",
Expires = now.AddSeconds(30),
SigningCredentials = new Microsoft.IdentityModel.Tokens.SigningCredentials(new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(symmetricKey), Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature)
};
var token = tokenHandler.CreateToken(tokenDescriptor);
var tokenString = tokenHandler.WriteToken(token);
JObject jObjectbody = new JObject();
jObjectbody.Add("topic", "test");
jObjectbody.Add("duration", "10");
jObjectbody.Add("start_time", "2021-06-30T05:00:00");
jObjectbody.Add("type", "2");
var client = new RestClient("https://api.zoom.us/v2/users/myemail@mycompany.com/meetings");
var request = new RestRequest(Method.POST);
request.AddHeader("authorization", String.Format("Bearer {0}", tokenString));
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", jObjectbody, ParameterType.RequestBody);
IRestResponse restResponse = client.Execute(request);
HttpStatusCode statusCode = restResponse.StatusCode;
return restResponse.Content;
}
Any help greatly appreciated