# Zoom SDK initialize failed when running the sample project

**URL:** <https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511>\
**Category:** Android\
**Created:** [August 7, 2020, 3:46am UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511 "2020-08-07T03:46:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![henry1](https://avatars.discourse-cdn.com/v4/letter/h/9fc348/32.png) [@henry1](https://devforum.zoom.us/u/henry1)\
**Post date:** [August 7, 2020, 3:46am UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/1 "2020-08-07T03:46:42Z")

</div>

I download the Android SDK of version [v5.0.24437.0708]. When running the sample project, I past the generated JWT from [[https://jwt.io/#libraries-io](https://jwt.io/#libraries-io)] webside with below paylaod:  
{  
“appKey”: “string”, // sdk key  
“iat”: long, // access token issue timestamp  
“exp”: long, // access token expire time  
“tokenExp”: long // token expire time  
}  
It always raise error onZoomSDKInitializeResult, errorCode=1, internalErrorCode=0

What should i do to fix it?

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [August 8, 2020, 1:09am UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/2 "2020-08-08T01:09:07Z")

</div>

Hi @henry1,

Thanks for using Zoom SDK. Based on the error code, it seems like the JWT token is invalid. Could you provide a sample of your payload(without the appKey)?

Thanks!

---

<div class="post-metadata">

**Author:** ![henry1](https://avatars.discourse-cdn.com/v4/letter/h/9fc348/32.png) [@henry1](https://devforum.zoom.us/u/henry1)\
**Post date:** [August 10, 2020, 3:05am UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/3 "2020-08-10T03:05:17Z")

</div>

Hi, Carson:  
I used below payload:  
{  
“appKey”: “string”//SDK key  
“iat”: 1597028327962, //milliseconds. System.currentTimeMillis()  
“exp”: 1597114727962, [//milliseconds.System.currentTimeMillis](https://milliseconds.System.currentTimeMillis)()+24_60_60_1000  
“tokenExp”: 1597114727962 [//milliseconds.System.currentTimeMillis](https://milliseconds.System.currentTimeMillis)()+24_60_60_1000  
}

BTW, I also tried to calculate the JWT from java codes with io.jsonwebtoken.Jwts. But, I found the result is different from the one i generated from [[https://jwt.io/#libraries-io](https://jwt.io/#libraries-io)] with same input. Pls advise it. See below codes in java

public static void main(String args)throws Exception{  
long timestamp = System.currentTimeMillis();  
Date(2020,8,7).getTime();  
System.out.println(timestamp);  
System.out.println(timestamp+24_60_60\*1000);  
Map\<String, Object\> header = new HashMap();  
header.put(“alg”,“HS256”);  
header.put(“typ”, “JWT”);  
Map\<String, Object\> payload = new HashMap();  
payload.put(“appKey”, \_SDK\_KEY);  
payload.put(“iat”, timestamp);  
payload.put(“exp”, timestamp);  
payload.put(“tokenExp”, timestamp);  
//SecretKey key = Keys.hmacShaKeyFor(Decoders.BASE64URL.decode(\_SDK\_SEC));  
SecretKey key = Keys.hmacShaKeyFor(\_SDK\_SEC.getBytes(StandardCharsets.UTF\_8));  
String token = Jwts.builder().setHeader(header).setClaims(payload).signWith(key, SignatureAlgorithm.HS256)  
.compact();

```
System.out.println(token);

```

}

May I know what is the encoding format of the generated SDK secret from zoom SDK app?

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [August 14, 2020, 5:35am UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/4 "2020-08-14T05:35:02Z")

</div>

Hi @henry1,

Thanks for the reply and the code snippet. The timestamp in the JWT token should be in seconds, and the “exp” should be at most 48 hours from “iat” and the “tokenExp” should be at least 30 minutes from “iat”.

Please have a try. Thanks!

---

<div class="post-metadata">

**Author:** ![huda.anwar94](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/huda.anwar94/32/14647_2.png) [@huda.anwar94](https://devforum.zoom.us/u/huda.anwar94)\
**Post date:** [September 4, 2020, 11:26am UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/5 "2020-09-04T11:26:39Z")

</div>

Hi Carson,  
I have the same problem and I tried your solution but I still get the same error Failed to initialize zoom SDK Error:1, InternalErrorCode = 0  
this is my payload:  
{  
“appKey”: “SDK\_KEY”,  
“iat”: 1599215 ,  
“exp”: 1599350 ,  
“tokenExp”: 3600  
}

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [September 4, 2020, 4:34pm UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/6 "2020-09-04T16:34:21Z")

</div>

Hi @huda.anwar94, thanks for the post.

The issue appears to be with your values being some point in January of 1970. For reference, current epoch time as I am writing this response is 1599236975. The `tokenExp` value should be in epoch time as well.

Thanks!

---

<div class="post-metadata">

**Author:** ![huda.anwar94](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/huda.anwar94/32/14647_2.png) [@huda.anwar94](https://devforum.zoom.us/u/huda.anwar94)\
**Post date:** [September 4, 2020, 4:58pm UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/7 "2020-09-04T16:58:41Z")

</div>

Hi @jon.zoom,  
Thanks for replying I converted the time from milliseconds to seconds it’s today’s date but in seconds I will try it again in milliseconds.

Thanks

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [January 21, 2021, 3:01am UTC](https://devforum.zoom.us/t/zoom-sdk-initialize-failed-when-running-the-sample-project/26511/9 "2021-01-21T03:01:17Z")

</div>

Hey @apresence,

Thanks!

Michael
