# JWT tocken init sdk errorcode=1

**URL:** <https://devforum.zoom.us/t/jwt-tocken-init-sdk-errorcode-1/91341>\
**Category:** Android\
**Created:** [July 5, 2023, 9:42am UTC](https://devforum.zoom.us/t/jwt-tocken-init-sdk-errorcode-1/91341 "2023-07-05T09:42:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abc2353319759](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@abc2353319759](https://devforum.zoom.us/u/abc2353319759)\
**Post date:** [July 5, 2023, 9:42am UTC](https://devforum.zoom.us/t/jwt-tocken-init-sdk-errorcode-1/91341/1 "2023-07-05T09:42:59Z")

</div>

HashMap\<String,Object\> header=new HashMap\<\>();  
header.put(“alg”, “HS256”);  
header.put(“typ”, “JWT”);

```
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
    long time = calendar.getTime().getTime() ;
    calendar.add(Calendar.YEAR,1);
    long time2 =calendar.getTime().getTime();
    
    try {
        String jwt=Jwts.builder().setHeader(header).
                claim("appKey",SDK_KEY).
                claim("iat",time).
                claim("exp",time2).
                claim("tokenExp",time2).
                signWith(SignatureAlgorithm.HS256,SDK_SECRET.getBytes("UTF-8")).
                compact();
        Log.d("TAG", "onCreate: jwt5555 = "+jwt);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

```

Metting sdk init result is error ，errorCode =1  
sdk visontion is 5.14

---

<div class="post-metadata">

**Author:** ![abc2353319759](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@abc2353319759](https://devforum.zoom.us/u/abc2353319759)\
**Post date:** [July 6, 2023, 12:35am UTC](https://devforum.zoom.us/t/jwt-tocken-init-sdk-errorcode-1/91341/2 "2023-07-06T00:35:29Z")

</div>

No pm to help look at this problem

---

<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:** [July 6, 2023, 3:29am UTC](https://devforum.zoom.us/t/jwt-tocken-init-sdk-errorcode-1/91341/3 "2023-07-06T03:29:18Z")

</div>

@abc2353319759 , errorcode=1 might be related to the timestamp.

Could you try setting IAT to now, and EXP to 35-60 minutes from now?  
The requirement is EXP has to be minimally 30 mins from IAT, but to avoid errors caused by time drifting, or slight accuracy difference, try to use 35-60 mins

Let me know if it works. If it does not, please tag me in your reply

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [August 5, 2023, 1:29pm UTC](https://devforum.zoom.us/t/jwt-tocken-init-sdk-errorcode-1/91341/4 "2023-08-05T13:29:44Z")

</div>

Closed on August 5, 2023, 1:29pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
