cancel
Showing results for 
Search instead for 
Did you mean: 

Zoom Meeting is Not Getting Launch

SaurabhJ
Listener

 

I am using Zoom SDK, Version - 5.16.10 and i am not able to launch the zoom meeting i am not getting success after passing the JWT token.

As the token which i am getting i am verifying it on https://jwt.io/ website also but it is giving Invalid Signature but after doing changes on my JWT token got verified also then i pass that token in my SDK also but still i am getting 

"tokenWrong" error. As i have tried multiple times but not got success also my client key and secret key is also correct as i have verified it also. So problem is that after passing correct token also i am not getting success . Please help me!!!

1 REPLY 1

SaurabhJ
Listener

Here is the  function which i am using to make JWT token is given below :- 

func generateSignature(key: String, secret: String, meetingNumber: Int, role: Int) -> String? {

        let iAT = Int(Date().timeIntervalSince1970)

        let exp = iAT + 60 * 60 * 2

        let header = ["alg": "HS256", "typ": "JWT"]

        let payload =

        [

            "appKey": "\(key)",

            "iat": "\(iat)",

            "exp": "\(exp)",

            "tokenExp": "\(exp)",

            "userName": "John Doe"

        ]

        guard let headerData = try? JSONSerialization.data(withJSONObject: header,

                                                           options: [.prettyPrinted]) else {

            return nil

        }

        guard let payloadData = try? JSONSerialization.data(withJSONObject: payload,

                                                            options: [.prettyPrinted]) else {

            return nil

        }

        

        let base64UrlEncodedHeader = headerData.base64EncodedString()

            .replacingOccurrences(of: "+", with: "-")

            .replacingOccurrences(of: "/", with: "_")

            .replacingOccurrences(of: "=", with: "")

        let base64UrlEncodedPayload = payloadData.base64EncodedString()

            .replacingOccurrences(of: "+", with: "-")

            .replacingOccurrences(of: "/", with: "_")

            .replacingOccurrences(of: "=", with: "")

        let signatureData = HMAC<SHA256>.authenticationCode(for: (base64UrlEncodedHeader + "." + base64UrlEncodedPayload).data(using: .utf8)!, using: SymmetricKey(data: secret.data(using: .utf8)!))

        let base64UrlEncodedSignature = Data(signatureData).base64EncodedString()

            .replacingOccurrences(of: "+", with: "-")

            .replacingOccurrences(of: "/", with: "_")

            .replacingOccurrences(of: "=", with: "")

        let token = "\(base64UrlEncodedHeader).\(base64UrlEncodedPayload).\(base64UrlEncodedSignature)"

        return token

    }