# AuthContext throwing SDKError 15

**URL:** <https://devforum.zoom.us/t/authcontext-throwing-sdkerror-15/34243>\
**Category:** Windows\
**Created:** [October 25, 2020, 9:56pm UTC](https://devforum.zoom.us/t/authcontext-throwing-sdkerror-15/34243 "2020-10-25T21:56:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Proddy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/proddy/32/15671_2.png) [@Proddy](https://devforum.zoom.us/u/Proddy)\
**Post date:** [October 25, 2020, 9:56pm UTC](https://devforum.zoom.us/t/authcontext-throwing-sdkerror-15/34243/1 "2020-10-25T21:56:18Z")

</div>

**Description**  
When running _CZoomSDKeDotNetWrap.Instance.GetAuthServiceWrap().SDKAuth(param)_ with an _AuthContext_ param, returns SDKError 15, which doesn’t have a value in the Enum so I’m unsure on the error.

**Which version?**  
5.2.41727.0928

**To Reproduce(If applicable)**  
Run the following code:

```
AuthContext param = new AuthContext();
param.jwt_token = "JWT TOKEN HERE";
SDKError err = CZoomSDKeDotNetWrap.Instance.GetAuthServiceWrap().SDKAuth(param);
if (err != SDKError.SDKERR_SUCCESS)
{
    MessageBox.Show("There was an error authorising with Zoom:" + err.ToString());
}

```

**Screenshots**  
N/A

**Additional context**  
Authorising with an _AuthParam_ and _appKey_/_appSecret_ works fine.

---

<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:** [October 30, 2020, 7:15am UTC](https://devforum.zoom.us/t/authcontext-throwing-sdkerror-15/34243/2 "2020-10-30T07:15:03Z")

</div>

Hi @Proddy,

Thanks for the reply. The error code indicates that the JWT token is invalid. Please follow the instruction here to generate the JWT token: [https://github.com/zoom/zoom-c-sharp-wrapper#initializing-sdk-with-jwt-token](https://github.com/zoom/zoom-c-sharp-wrapper#initializing-sdk-with-jwt-token)

And here is a handy python script that could be helpful to generate the JWT token:

```auto
    iat = long(int(time.time()))
    exp = long((datetime.datetime.today() + datetime.timedelta(days=2)).strftime("%s"))
    tokenExp = long((datetime.datetime.today() + datetime.timedelta(hours=1)).strftime("%s"))

    payload = {
        'appKey': key,
        'iat': iat,
        'exp': exp,
        'tokenExp': tokenExp
    }
    encoded = jwt.encode(payload, secret, algorithm='HS256')

```

Hope this helps. Thanks!

---

<div class="post-metadata">

**Author:** ![Proddy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/proddy/32/15671_2.png) [@Proddy](https://devforum.zoom.us/u/Proddy)\
**Post date:** [October 30, 2020, 1:38pm UTC](https://devforum.zoom.us/t/authcontext-throwing-sdkerror-15/34243/3 "2020-10-30T13:38:54Z")

</div>

Hi Carsen,

Thanks for getting back to me. I’d seen that Python snippet on another thread and tried to do that with _Microsoft.IdentityModel.Tokens_ and the following code:

```
Dim appKey As String = "Key"
Dim appSecret As String = "Secret"
Dim iat As Long = DateTimeOffset.UtcNow.ToUnixTimeSeconds
Dim exp As Long = iat + 60 * 60
Dim securityKey As New SymmetricSecurityKey(Encoding.UTF8.GetBytes(appSecret))
Dim credentials As New SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256)
Dim header As New JwtHeader(credentials)
Dim payload As New JwtPayload()
payload.AddClaim(New Claim("appKey", appKey))
payload.AddClaim(New Claim("iat", iat))
payload.AddClaim(New Claim("exp", exp))
payload.AddClaim(New Claim("tokenExp", exp))
Dim secToken As New JwtSecurityToken(header, payload)
Dim handler As New JwtSecurityTokenHandler()
Dim token As String = handler.WriteToken(secToken)

```

However that’s the token that was causing SDKError 15. Can you noticed anything wrong with that?

Thanks,  
Josh
