This repository was archived by the owner on Jun 12, 2023. It is now read-only.
This repository was archived by the owner on Jun 12, 2023. It is now read-only.
在TIM 后台验证通过的 userSig ,调用 login 时报错 userSig expired #10
Closed
Description
报错:
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(6206, Execution Error, userSig expired)
在 TIM 后台验证 userSig 是正确的:
class TIM{
init()async{
await TencentImPlugin.init(appid: "14003450xx");
}
initStorage(String useridIm)async{
await TencentImPlugin.initStorage(identifier: useridIm);
}
getUserSig(String useridIm)async{
Map data = {
"id_im": useridIm
};
Map res =await Request().post(data, '/account/tls_sig/');
if(res["statusCode"]==200){
return res["data"];
}
}
login(String useridIm, String userSig)async{
TencentImPlugin.login(identifier: useridIm, userSig: userSig);
}
logout() {
TencentImPlugin.logout();
}
}
startTIM()async{
userAccountModel = Provider.of<UserAccountModel>(context);
String useridIm = generateImUserId(userAccountModel.useraccount);
await TIM().init();
await TIM().initStorage(useridIm);
String userSig = await TIM().getUserSig(useridIm);
log("#### tim user id $useridIm ####");
log("#### tim user sig is $userSig ####");
TIM().login(useridIm, userSig);
}
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G87, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 3.6)
[✓] VS Code (version 1.43.2)
[✓] Connected device (2 available)
• No issues found!
Metadata
Metadata
Assignees
Labels
No labels