Hi,
according to your documentation, once user decide to “Cancel” google login operation, we do
await Web3AuthFlutter.logout();
this method throws an exception…
Here the code:
W/System.err(13709): java.lang.NumberFormatException: Zero length BigInteger
W/System.err(13709): at java.math.BigInteger.(BigInteger.java:485)
W/System.err(13709): at com.web3auth.session_manager_android.keystore.KeyStoreManager.getPubKey(KeyStoreManager.kt:161)
W/System.err(13709): at com.web3auth.session_manager_android.SessionManager.invalidateSession(SessionManager.kt:212)
W/System.err(13709): at com.web3auth.core.Web3Auth.logout(Web3Auth.kt:217)
W/System.err(13709): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin.runMethodCall(Web3AuthFlutterPlugin.kt:123)
W/System.err(13709): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin.access$runMethodCall(Web3AuthFlutterPlugin.kt:25)
W/System.err(13709): at com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin$onMethodCall$1.invokeSuspend(Web3AuthFlutterPlugin.kt:71)
W/System.err(13709): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
W/System.err(13709): at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
W/System.err(13709): at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
W/System.err(13709): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
W/System.err(13709): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
W/System.err(13709): at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
D/com.web3auth.flutter.web3auth_flutter.Web3AuthFlutterPlugin(13709): #logout
E/flutter (13709): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, java.util.concurrent.ExecutionException: java.lang.Exception: java.lang.NumberFormatException: Zero length BigInteger, java.util.concurrent.ExecutionException: java.lang.Exception: java.lang.NumberFormatException: Zero length BigInteger, null)
E/flutter (13709): #0 Web3AuthFlutter.logout (package:web3auth_flutter/web3auth_flutter.dart:51:7)
E/flutter (13709):
E/flutter (13709): #1 AuthenticationCubit.loginWithSocial (package:mobile_csa/core/cubit/authentication_cubit.dart:610:7)
E/flutter (13709):
E/flutter (13709): #2 PreviewLogin.build.. (package:mobile_csa/screens/onboarding_screen/widget/preview_login.dart:69:33)
E/flutter (13709):
For any additional info, please let me know to provide you all the required info.
Hey, you don’t need to call Web3AuthFlutter.logout upon user cancellation. Can you please share the code snippet, and also where did you read in the documentation. If it’s mentioned in the documentation, that’s wrong and we’ll fix it.
Hey, thank you for your support. Here you the snippet
Future loginWithSocial(Web3AuthEnums.Provider social) async {
try {
emit(CubitStateLoading(state.data));
final Web3AuthResponse response = await Web3AuthFlutter.login(
LoginParams(
mfaLevel: Web3AuthEnums.MFALevel.NONE,
loginProvider: social,
),
);
final result = await loginSocialWithBackend(response);
if (result == false) {
return false;
}
} catch (e) {
await Web3AuthFlutter.logout();
return false;
}
return true;
}
.
Once user close the webview or “cancel” the account choosen, we can’t go in web3auth again.
If you need a call please let me know,
You don’t need to do Web3AuthFlutter.logout in catch block. Since, you are not logged in and trying to logout, that’s why there is the exception. Can you share the video of the above case?
I can post a video for privacy reason, but…when you select a valid google mail, flutter sdk let you choose between “cancel” and “confirm” button. If you decide to cancel the process, this throws correctly an exception, but if you want to go inside web3auth sdk, it does not open any views.
@Ayush Could you let me know the correct flow to avoid that web3auth cannot be re open when the operation is cancelled?
I could schedule a quick call to show you the flow.
let me know
I think I get your issue, this is a known issue, we are trying to fix it. We’ll let you know once the fix is available. Thanks for reporting. Meanwhile, if you are using the SDK version less than 4.0.0, you can use the setResultUrl which we added as the temporary fix. You can take a reference on how to use setResultUrl in this Pull Request.
Let me know if using the setResultUrl fixes it. You can use the SDK version 3.1.7, as it’s removed in the latest release 4.0.0
Thank for you pullrequest. We would avoid to use temporary fix, instead we prefer wait till you release a new version.
How long will you take to release the fix on pub dev?
We don’t have a tentative date as of now, we trying to resolve it as soon as possible. I’ll make sure to update you as soon as the fix is available and new version is released.