Errors on JTW Video SDK authentication

Format Your New Topic as Follows:

Video SDK Type and Version
We are using latest UI-Toolkit on VideoSDK

Description
We have implemented an API within our backend that generates a jwt token according to the specifications indicated in the documentation.
When we pass the token to the VideoSDK web ui-toolkit, in some cases we get the error:

zoomsdkjsonpcallback1({
“status”: false,
“errorCode”: 124,
“errorMessage”: “Verify JWT Failed: The token was expected to have 3 parts, but got 1.”
})

We have already verified that the token contains all the necessary fields in the payload.

Sometimes a token that fails on some subsequent attempt works fine.

Error?
Verify JWT Failed: The token was expected to have 3 parts, but got 1.

How To Reproduce
As indicated in the description, the error is not systematic but only occurs at certain times, this is a token for example that did not work:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcHBfa2V5IjoiSVhSS3pFWG1sbnFDMXNtNnNvVG5xdGtXSU1SQVBHZ0lPNWpNIiwicm9sZV90eXBlIjoxLCJ0cGMiOiJQQnFaeXROdWF3UXVKalBra3JIb0RLdUdJY2ZBV053S0RGY0UiLCJleHAiOjE3MDkxNjUzMTAsInZlcnNpb24iOjEsImlhdCI6MTcwOTEyOTMxMH0.2fTBICqoAR4/1jhyScgzjlrKpvBoHF3GubVUpzw+C7s=

This is an example of a token that fails:
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhcHBfa2V5IjoiSVhSS3pFWG1sbnFDMXNtNnNvVG5xdGtXSU1SQVBHZ0lPNWpNIiwicm9sZV90eXBlIjoxLCJ0cGMiOiJQQnFaeXROdWF3UXVKalBra3JIb0RLdUdJY2ZBV053S0RGY0UiLCJleHAiOjE3MDkxNjUzMTAsInZlcnNpb24iOjEsImlhdCI6MTcwOTEyOTMxMH0.2fTBICqoAR4/1jhyScgzjlrKpvBoHF3GubVUpzw+C7s=

@coincydence something went wrong with the last part of your signature generation. It is not accepted as a valid input, hence it mentions the error

“errorMessage”: “Verify JWT Failed: The token was expected to have 3 parts, but got 1.”

Could you check the generation logic and try again?

Thanks for the reply, I am still wondering why sometimes the token works correctly and sometimes not, considering that it is always generated with the same code.

Problem solved!

It’s a problem related to signature final encoding, so by using:

Base64.getUrlEncoder().encodeToString(signedBytes);

instead of

Base64.getEncoder().encodeToString(signedBytes);

My bad.

authentication works