Flutter - Firebase (JWT) and system time error

Hi there, I'm trying to use my Firebase JWT token id to create a user and wallet with Web3Auth in Flutter (Custom Authentication).
(By the way, I needed to use jwt-login-fixes branch to be able to reach to this point. With the master branch I just got a blank screen with the Web3Auth logo at the bottom of the page without reconstructing the private key message and spinner)
I think I've done everything based on the documents and guides but I received this error when Web3Auth is trying to reconstruct the private-key.

Tested device: Samsung Galaxy S20
Android version: 12

There seems to be some bug in the code. Please contact support to fix this.Your system time is incorrect. Please correct your system time and login again"
Also sometimes I get this error instead of the above message (with the same code!):
Unable to detect login share from the Auth Network. This may be due to slow internet connection. Check your internet speed and try again.

The errors that I got were exactly the same as this one:
https://github.com/Web3Auth/web3auth-web/discussions/515#discussioncomment-3624987

Could you please let me know what is the issue?

This is my code in Flutter:

http://localhost:3000")));
}">
    if (Platform.isAndroid) {
redirectUrl = Uri.parse(‘w3a://com.example.w3aflutter/auth’);
} else if (Platform.isIOS) {
redirectUrl = Uri.parse(‘com.example.w3aflutter://openlogin’);
} else {
throw UnKnownException(‘Unknown platform’);
}

final loginConfig = HashMap<String, LoginConfigItem>();
loginConfig[‘jwt’] = LoginConfigItem(
verifier: “verifier_name”,
typeOfLogin: TypeOfLogin.jwt,
name: “Custom JWT Login”,
clientId: “The_web3auth_dashboard_client_id”,
);

await Web3AuthFlutter.init(Web3AuthOptions(
    clientId: "The_web3auth_dashboard_client_id",
    network: Network.cyan,
    redirectUrl: redirectUrl,
    whiteLabel: WhiteLabelData(
        dark: true, name: "Web3Auth Flutter App", theme: themeMap),
    loginConfig: loginConfig
),);

Future<Web3AuthResponse> _withJWT() {
return Web3AuthFlutter.login(LoginParams(
loginProvider: Provider.jwt,
extraLoginOptions: ExtraLoginOptions(
verifierIdField: ‘sub’,
response_type: ‘token’,
id_token: idToken, //Received from firebase login
domain: “http://localhost:3000”)));
}



Originally posted by: iNima

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/757

I also have the same issues.



Originally posted by: nisa10880

Hey all,

We have released v1.0.3 that fixes the JWT Login issue. Please update your code to use the latest version.

https://pub.dev/packages/web3auth_flutter



Originally posted by: shahbaz17

There can be two reasons of this:-

  1. Either your system clock is really out of sync.
  2. The jwt token you are passing in web3auth sdk is older than 1 min. Web3Auth network only accepts unique tokens which are not older than 60 sec so make sure to pass a unique freshly generated jwt token.

If above doesn't solves your issue, plz attach console logs for more debugging on our side.



Originally posted by: himanshuchawla009

I checked out Flutter x JWT (Firebase) Example and it worked on my device, so I knew the issue was related to my Web3Auth dashboard configuration.
I created a new custom auth verifier from scratch and it worked.
Unfortunately, on the dashboard we can't see the verifier parameters so I can't tell what parameter wasn't set correctly in the previous faulty verifier.

Thanks for you help.



Originally posted by: iNima

Hi @shahbaz17,
Thanks for the reply.

These are the changes I applied so far:

  • I set the true parameter in the getIdToken(true)
  • I removed response_type: 'token' from the ExtraLoginOptions

These are my verifier parameters:

  • Network -> cyan
  • iss -> https://securetoken.google.com/<firebase_project_name>
  • aud -> <firebase_project_name>
  • JWT Verifier ID -> sub
  • JWK Endpoint -> https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com

After running the app again I still receive this error:
Unable to detect login share from the Auth Network. This may be due to slow internet connection. Check your internet speed and try again.



Originally posted by: iNima

@iNima could you please let me know what you entered for your custom auth verifier settings - I am following the instructions here https://web3auth.io/docs/guides/firebase and getting the same error as you 'Unable to detect login share from the Auth Network. This may be due to slow internet connection. Check your internet speed and try again.' Although the user count gets increased in the dashboard, so there is something going on for sure.

Any help on this would be appreciated!



Originally posted by: seakkus