# Errors on JTW Video SDK authentication

**URL:** <https://devforum.zoom.us/t/errors-on-jtw-video-sdk-authentication/104758>\
**Category:** Video SDK\
**Tags:** video-sdk, jwt\
**Created:** [February 29, 2024, 9:49am UTC](https://devforum.zoom.us/t/errors-on-jtw-video-sdk-authentication/104758 "2024-02-29T09:49:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![coincydence](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@coincydence](https://devforum.zoom.us/u/coincydence)\
**Post date:** [February 29, 2024, 9:49am UTC](https://devforum.zoom.us/t/errors-on-jtw-video-sdk-authentication/104758/1 "2024-02-29T09:49:35Z")

</div>

### 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=

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [March 1, 2024, 7:39am UTC](https://devforum.zoom.us/t/errors-on-jtw-video-sdk-authentication/104758/2 "2024-03-01T07:39:46Z")

</div>

> [@coincydence](#):
>
> 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?

---

<div class="post-metadata">

**Author:** ![coincydence](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@coincydence](https://devforum.zoom.us/u/coincydence)\
**Post date:** [March 4, 2024, 8:30am UTC](https://devforum.zoom.us/t/errors-on-jtw-video-sdk-authentication/104758/3 "2024-03-04T08:30:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![coincydence](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@coincydence](https://devforum.zoom.us/u/coincydence)\
**Post date:** [March 6, 2024, 11:04am UTC](https://devforum.zoom.us/t/errors-on-jtw-video-sdk-authentication/104758/4 "2024-03-06T11:04:42Z")

</div>

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
