Description
I created an app and copied the JWT token which is valid for 1 day by going into app credentials section and made a call to create a meeting and successfully got a response. However, when I generate credentials within code using JWT example given here I get an error. Code example -
async function getToken(){
const APIKey = "API key here";
const secret = "secret here";
const payload = {
iss: APIKey,
exp: ((new Date()).getTime() + 5000)
};
const token = jwt.sign(payload, APISecret);
return jwt.sign(payload, secret);
}
async function createMeeting(token){
email = "user email here";
let config = {
headers: { Authorization: `Bearer ${token}` }
};
let data = {
"topic": "test create meeting",
"type": 1,
"settings": {
"host_video": "true",
"participant_video": "true"
}
};
let resp = await axios.post(
"https://api.zoom.us/v2/users/" + email + "/meetings",
data,
config
);
console.log(resp.data);
return "done";
}
async function f(){
let token = await getToken();
console.log("token -> ", token);
await createMeeting(token);
}
f();
Error
{“code”:124,“message”:“The Token’s Signature resulted invalid when verified using the Algorithm: HmacSHA256”}
Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT
Which Endpoint/s?
Problem exists with all endpoints.
How To Reproduce (If applicable)
Steps to reproduce the behavior:
- run the code given above
Screenshots (If applicable)
Steps explain everything I am doing
Additional context
N/A