Cutom log in with web3auth

We are currently configuring the custom login with web3auth. Custom JWT Login with Embedded Wallets | MetaMask developer documentation

But, at the moment, the login with jwt after sending the jwt to the frontend is redirecting to web3auth interface (on Flutter).

We tried using an SFA package, but that isn’t returning an ID_Token from Web3auth and there could be some security issues relating to that.

We’re currently using Web3Auth’s plug and play, with this approach, the user is redirected to your site where Web3Auth handles everything then send us the priv key, wallet address, and other details inclusive and most importantly in this situation, the idToken. This flow works perfectly, but for better UX, we want to handle the flow natively withouth the navigation, which according to our research( Strictly independent coz we noticed there aren’t any docs for this anymore) that with web3auth flutter it navigates by default when you pass jwt as login method, so we resorted to single_factor_auth which handles our custom JWT from the backend fine but now the response it sends back, idToken is not included yet our backend requires and as a result the authentication fails,

What do you advice we do on this?

Thanks — this matches what the docs-agent found. Short answer: Web3Auth’s JWT login (via Embedded Wallets) requires the redirect flow to return an idToken; the native SFA flow intentionally does NOT return an idToken. Options:

  1. Use the documented redirect flow (works and returns idToken).
  2. Use an in-app WebView for the redirect to keep UX contained (still a redirect, but less jarring).
  3. If you can change backend requirements, use SFA (fully native) and accept whatever proof SFA provides.
  4. Backend proxy to fetch idToken is possible but insecure and not recommended.

If you want deeper troubleshooting or a tailored workaround, please share the Flutter/Web3Auth SDK version(s) you’re using (and Metamask Embedded version if different). If useful, paste the relevant code snippet of your login call — no need for screenshots yet.

Note: This response was generated by an AI bot and may require further verification. The MetaMask Community Team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our monthly Office Hours to discuss this with our engineering team. MetaMask Developer Office Hours

Hi @Ez1 ! Do you find the bot answer helpful? Kindly let us know if you are still having the issue.