I am working on zoom sdk in iOS and android. we have existing application it worked fine till 2days back suddenly user unable to join meeting. we checked and identified the root cause.
Error?
when I initializing the sdk with jwt token it giving
**
Zoom auth result code: 11 and it returning token wrong. so we are unable to get meeting settings and meeting service from Mobile rtc.
we havent touched anything in code. below is the code to generate jwt token.
func generateSignature(appKey: String, appSecret: String) -> String? {
let now = Int(Date().timeIntervalSince1970)
let iat = now - 30
let exp = now + (2 * 60 * 60) // 2 hours
let header: [String: Any] = [
"alg": "HS256",
"typ": "JWT"
]
let payload: [String: Any] = [
"appKey": appKey,
"iat": iat,
"exp": exp,
"tokenExp": exp
]
func base64URLEncode(_ data: Data) -> String {
data.base64EncodedString()
.replacingOccurrences(of: "+", with: "-")
.replacingOccurrences(of: "/", with: "_")
.replacingOccurrences(of: "=", with: "")
}
guard
let headerData = try? JSONSerialization.data(withJSONObject: header),
let payloadData = try? JSONSerialization.data(withJSONObject: payload)
else {
return nil
}
let headerEncoded = base64URLEncode(headerData)
let payloadEncoded = base64URLEncode(payloadData)
let signingInput = "\(headerEncoded).\(payloadEncoded)"
let key = SymmetricKey(data: Data(appSecret.utf8))
let signature = HMAC<SHA256>.authenticationCode(
for: Data(signingInput.utf8),
using: key
)
let signatureEncoded = base64URLEncode(Data(signature))
let jwt = "\(signingInput).\(signatureEncoded)"
print("Generated Meeting SDK JWT:", jwt)
return jwt
}
let remoteConfig = RemoteConfig.remoteConfig()
let zoomKeys = remoteConfig[LatestUpdateChecker.ZOOM_KEYS].jsonValue
if let zoomMeetKeys = zoomKeys as? [String: Any]{
if let domain = zoomMeetKeys[LatestUpdateChecker.ZOOM_DOMAIN] as? String, let appSecret =
zoomMeetKeys[LatestUpdateChecker.ZOOM_APP_SECRET] as? String, let appKey = zoomMeetKeys[LatestUpdateChecker.ZOOM_APP_KEY] as? String{
if let jwtToken = self.generateSignature(key: appKey, secret: appSecret){
appDelegate?.setupSDK(jwtToken, domain: domain)
}
}
}
The below code is to set up sdk using jwt.
func setupSDK(_ jwt: String?, domain: String) {
let context = MobileRTCSDKInitContext()
context.domain = domain
context.enableLog = true
let sdkInitSuc = MobileRTC.shared().initialize(context)
print("Zoom init result:", sdkInitSuc)
if sdkInitSuc {
let authService = MobileRTC.shared().getAuthService()
print(MobileRTC.shared().mobileRTCVersion)
if let authService = authService {
authService.jwtToken = jwt
authService.delegate = self
authService.sdkAuth()
}}
}
We have checked in zoom market place and verified the key and secret. we are getting same from fire base also.
My main question is why it suddently stopped working. how can we quickly fix this. is there any configuration issue as it araised in both andorid and iOS at the same time.
@chunsiong.zoom Can you please help us to fix this issue asap. Thanks