We have observed that when an existing SFA user but with expired session tries to call SingleFactorAuthFlutter.connect
again the following error is raised PlatformException(TorusUtils.TorusUtilError, default Error msg, invalid result from nodes, threshold number of public key results are not matching, please check configuration, null)
Here are some details about my initialization code, configuration code and some SDK details
@override
Future<Either<SFAConfigurationFailure, Unit>> configureSFA() =>
handleData<SFAConfigurationFailure, Unit>(
dataSourceOperation: () async {
final web3AuthOptions = Web3AuthOptions(
network: _computeWeb3AuthNetwork(),
clientId: dotenv.env[web3AuthClientId]!,
sessionTime: 60, // Purposely reduced session time to 1 minute to simulate this issue
);
await _singleFactorAuthentication.init(
web3AuthOptions,
);
return unit;
},
onSuccess: (unit) => unit,
onFailure: (_) => SFAConfigurationFailure(),
);
Web3AuthNetwork _computeWeb3AuthNetwork() {
const environment = String.fromEnvironment(
flavours,
defaultValue: devEnvironment,
);
if (environment == devEnvironment || environment == stageEnvironment) {
return Web3AuthNetwork.sapphire_devnet;
}
return Web3AuthNetwork.cyan;
}
@override
Future<Either<SFAInitializationFailure, Unit>> initializeSFA() =>
handleData<SFAInitializationFailure, Unit>(
dataSourceOperation: () async {
await _singleFactorAuthentication.initialize();
return unit;
},
onSuccess: (unit) => unit,
onFailure: (_) => SFAInitializationFailure(),
);
In the code I always await _authRepository.configureSFA()
and then await _authRepository.initializeSFA()
immediately after, when the app starts before I call any APIs on SingleFactorAuthFlutter
subsequently
- SDK Version: 6.0.1 (latest)
- Platform: Android and iOS
- Email:
testrestrictionsapp@gmail.com
- Verifier:
skytrade-dev-google-email
- Verifier Sub-identifier :
skyT-dev-oauth-EPLess
- Sample idToken (JWT):
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlVMVW1jM2lYbk5tMjRPTnAtOWd4dSJ9.eyJuaWNrbmFtZSI6InRlc3RyZXN0cmljdGlvbnNhcHAiLCJuYW1lIjoidGVzdHJlc3RyaWN0aW9uc2FwcEBnbWFpbC5jb20iLCJwaWN0dXJlIjoiaHR0cHM6Ly9zLmdyYXZhdGFyLmNvbS9hdmF0YXIvNzFjZDhmNzViYjQzYWJjODM5ZmFkNDRjNjYwNTA4NmM_cz00ODAmcj1wZyZkPWh0dHBzJTNBJTJGJTJGY2RuLmF1dGgwLmNvbSUyRmF2YXRhcnMlMkZ0ZS5wbmciLCJ1cGRhdGVkX2F0IjoiMjAyNS0wMy0xMFQxMjo0MzoxOC41NjdaIiwiZW1haWwiOiJ0ZXN0cmVzdHJpY3Rpb25zYXBwQGdtYWlsLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJpc3MiOiJodHRwczovL2Rldi1hdXRoLnNreS50cmFkZS8iLCJhdWQiOiJrMkQydHdQT0ZZTVRrUmtGTXdGRGlzZ1pvTElmMGRiNyIsInN1YiI6ImVtYWlsfDY3OWI5NTgwNGMyYWY5MTI0YjFhNzY4YyIsImlhdCI6MTc0MTYxMDU5OSwiZXhwIjoxNzQxNjEwNjU5LCJzaWQiOiJSdTlrcmFFSDNPdWMycDFYOWVMdEZoNGdKZ252YXBvRiJ9.fkjxqxzkodmTvGkA2A_F7ouJ787ZW9g25UXwwS9IEhbM5eHkhnS_ZCG_8NMCkw_5f4L2Xl7jFnfBTfN98HlUuSMra0EbwIeIEr2FDdIJ-BcdYLTmIXkBFQg94m7fMHUYfwIdfljp_5a33n37NLAse57APgw3SpikQSk3Hrsz1Y5Wz6Jd5FQ1B0sK6hYene_ftfU6aC3ktC_w3I2lW1jt5kzdvUVpj7uWF2-jwZ56h2Gz6CJqsjBI5a2HKUe3It-H8KELDctai9K-oxY2NJB6Upr39Ev7JIcEZGT_8VpCrhIB6B3dGe2hMXnb9i6NzZZTyLMlRwUgVHP009kKpvfJkQ
I opened a ticket regarding this issue on the SFA repository issues page here Calling `SingleFactorAuthFlutter.connect` on user with expired SFA session throws a `PlatformException` but `SingleFactorAuthFlutter.connected` indicates that there is no SFA session · Issue #24 · Web3Auth/single-factor-auth-flutter · GitHub