Meeting SDK Upgrade Issue

Facing issue on up-gradation of Meeting SDK to v5.14.11.8690 “Value of type ‘MobileRTCAuthService’ has no member ‘clientKey’ and Value of type ‘MobileRTCAuthService’ has no member ‘clientSecret’”

@nausher ,

this has been removed in 5.14. For SDK Auth, do sign a JWT token using your secret and key.

Can you please any documentation how to sign a JWT Token.

i have also same problem please give us detail code snippet for this …

1 Like

@chunsiong.zoom
Yes there is no proper documentation for this.

1 Like

Here’s the guide

1 Like

@nausher if u solve this problem please share the code snippet … if i solve this i will share code snippet… this problem has not any proper solution on stackoverflow or chatgpt or internet… we need proper code snippet for this…

Sure i’m trying to generate JWT code.

1 Like

This is the code to generate JTW in Typescript:

     const KJUR = require('jsrsasign')

      const iat = Math.round((new Date().getTime() - 30000) / 1000)
      const exp = iat + 60 * 60 * 2
      const oHeader = { alg: "HS256", typ: "JWT" }

      const oPayload = {
        sdkKey: process.env.ZOOM_SDK_KEY,
        mn: meetingNumber,
        role: role, // 0 or 1
        iat: iat,
        exp: exp,
        appKey: process.env.ZOOM_SDK_KEY,
        tokenExp: iat + 60 * 60 * 2,
      }

      const sHeader = JSON.stringify(oHeader)
      const sPayload = JSON.stringify(oPayload)
      const signature = KJUR.KJUR.jws.JWS.sign(
        "HS256",
        sHeader,
        sPayload,
        process.env.ZOOM_SDK_SECRET,
      )

Link: Meeting SDK Auth

1 Like

But i’m finding in IOS Swift Language.

1 Like

please share code snippet for swift iOS

Sorry, I generate that on the BE to be shared among all platforms. I’ll see if I get time to do that in Swift and post it here later on.

2 Likes

import Foundation

func generateJWT(meetingNumber: String, role: Int) → String {
let iat = Int(Date().timeIntervalSince1970) - 30000
let exp = iat + 60 * 60 * 2
let header = [“alg”: “HS256”, “typ”: “JWT”]
let payload = [“sdkKey”: “ZOOM_SDK_KEY”, “mn”: meetingNumber, “role”: role, “iat”: iat, “exp”: exp, “appKey”: “ZOOM_SDK_KEY”, “tokenExp”: iat + 60 * 60 * 2]
let headerString = JSONEncoder().encode(header).base64EncodedString()
let payloadString = JSONEncoder().encode(payload).base64EncodedString()
let signature = HMACSHA256.hash(data: headerString + “.”, key: “ZOOM_SDK_SECRET”).base64EncodedString()
return headerString + “.” + payloadString + “.” + signature
}

let jwt = generateJWT(meetingNumber: “123456”, role: 1)
print(jwt)

This code will generate a JWT token that can be used to authenticate with Zoom. The generateJWT() function takes two arguments: the meeting number and the role. The role can be either 0 or 1, where 0 is a viewer and 1 is a host. The function returns a string that contains the JWT token.

To run this code, you will need to import the Foundation framework. You can do this by adding the following line to your project’s Podfile:

@purushottaminorbit26
This is working for you?

i just convert the @mehrshad javascript code into swift …

Great, thanks. I will also try it out

@mehrshad Please let us know if this will work on your side.

@chunsiong.zoom @purushottaminorbit26 @mehrshad

let secret = sdkSecret
let privateKey = SymmetricKey(data: Data(secret.utf8))
let headerJSONData = try! JSONEncoder().encode(Header())
let headerBase64String = headerJSONData.urlSafeBase64EncodedString()

    let payloadJSONData = try! JSONEncoder().encode(Payload())
    let payloadBase64String = payloadJSONData.urlSafeBase64EncodedString()

    let toSign = Data((headerBase64String + "." + payloadBase64String).utf8)

    let signature = HMAC<SHA256>.authenticationCode(for: toSign, using: privateKey)
    let signatureBase64String = Data(signature).urlSafeBase64EncodedString()

    let token = [headerBase64String, payloadBase64String, signatureBase64String].joined(separator: ".")

Generating Token By this way but its says invalid signature when i’m verifying it on https://jwt.io/

@nausher @chunsiong.zoom @mehrshad
I successfully generated JWT using zoom meeting sdk credentials and successfull initialize zoom sdk this morning and created a blog for solution to get access others also who are outside of this developer forum.
please check this blog for detail step by step guide - https://ioscruncher.blogspot.com/2023/06/solving-zoom-meeting-sdk-upgrade-issue.html

by next week, i will also upload the server to server auth app use case in get access token and generate zoom user id and create meeting as hoast or join meeting - so you can integrate it for your app.

Thanks @purushottaminorbit26 for informing us and for the article. I’ve read your article but I didn’t see you set the token for the SDK in your code, also didn’t see you use SDK authentication service to call sdkAuth() to verify the SDK token. May you please share how you did that?

Also, role and meeting number are not used in JWT creation.