Reputation: 1
I’m currently facing an issue with the JWT token I generated for joining calls using the 8x8 API. While the static JWT token from the portal works perfectly, the one I create programmatically results in the following error: "You cannot join the call."
Here are some details about my implementation:
Claims Verification: I’ve verified that the JWT contains all necessary claims, including exp, iss, and sub. Expiration: I ensure that the token is not expired. Audience Claim: I’ve checked that the aud claim is correctly set, as required by the API. Permissions: I’ve confirmed that the token has the required permissions for joining calls. Signing: I’m using the correct private key and signing algorithm. Additionally, I can successfully decrypt the generated JWT on jwt.io and see all the expected data.
Has anyone else encountered this issue or have tips on what I might be missing? Any guidance would be greatly appreciated!
Note: I’ve tried a solution (included in my GitHub repository) but it’s not working. Interestingly, when I use the static token generated from the 8x8 portal, it works perfectly fine.
Thank you!
GitHub Issue URL Issue : texthttps://github.com/8x8/jaas_demo/issues/16
repo : https://github.com/8x8/jaas_demo[text](https://stackoverflow.com)
const filepath = path.join(__dirname, "../../api/services/latest.pem");
const cert = fs.readFileSync(filepath, 'utf8');
let appId = 'vpaas-magic-cookie-da788650d1d84794*****91b'
let kid = "vpaas-magic-cookie-da788650d1******91b/2e**21-SAMPLE_APP"
try {
const { id, name, email } = req.body;
const now = new Date();
const avatar = 'https://lumiere-a.akamaihd.net/v1/images/a_avatarpandorapedia_jakesully_16x9_1098_02_b13c4171.jpeg?region=0%2C0%2C1920%2C1080'
const jwt = jsonwebtoken.sign(
{
aud: 'jitsi',
context: {
user: {
id,
name,
email,
avatar ,
moderator: 'true'
},
features: {
livestreaming: 'true',
recording: 'true',
transcription: 'true',
"outbound-call": 'true'
}
},
iss: 'chat',
room: '*',
sub: appId,
exp: Math.round(now.setHours(now.getHours() + 3) / 1000),
nbf: Math.round((new Date).getTime() / 1000) - 10
}
, cert, { algorithm: 'RS256', header: { kid } });
Upvotes: 0
Views: 65