Zoomtopia is here. Unlock the transformative power of generative AI, helping you connect, collaborate, and Work Happy with AI Companion.
Register nowEmpowering you to increase productivity, improve team effectiveness, and enhance skills.
Learn moreKeep your Zoom app up to date to access the latest features.
Download Center Download the Zoom appDownload hi-res images and animations to elevate your next Zoom meeting.
Browse Backgrounds Zoom Virtual BackgroundsEmpowering you to increase productivity, improve team effectiveness, and enhance skills.
Zoom AI Companion2023-11-26 11:35 PM
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!!!
2023-11-26 11:35 PM
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
}