I’m working on a Flutter app that integrates an external authentication system provided by another company. The login and password-reset flows are handled entirely inside a WebView (their backend + their hosted HTML pages).
Flow overview
- User opens the Flutter app
- Taps Login
- A WebView opens and loads the external login page
- User taps Forgot Password
- A second WebView opens (also external)
- User enters their email and submits the form
- Expected: a password-reset email is sent
The problem
On iOS, the request on step 6 never reaches the server. The WebView simply doesn’t send the request — no redirect, no network traffic. On Android, everything works perfectly. Also its super hard to generate any type of logs, just nothing happens when sending the request.
It looks like opening a second WebView on iOS causes a context switch that breaks the request. The external provider claims that their backend + pages are correctly configured, and since Android works, the issue seems to be on the iOS/WebView/Flutter side.
What we tried
- Originally used oauth2_client → same problem
- Switched to flutter_appauth → same problem
- Verified redirect URLs and callback schemes
- Cleared Xcode’s DerivedData
- Reset iOS build folder (flutter clean, removing /ios/Pods, pod install)
- Checked iOS entitlements
- Tried to configure persisting storage and cookies between both WEbViews (like preferEphemeralSession)
Nothing seems to fix the issue.
Has anyone encountered an issue where iOS blocks requests from a second WebView, especially when the flow involves authentication or form submission hosted externally?
Disclaimer: I am completely new to flutter + auth + ios So if you need any specific code just tell me and i try to give you all the information you need.
Future<void> signInWithUsernamePassword() async {
try {
_authType = AuthType.emailPassword;
AccessTokenResponse tkn = await _authProvider.authorizeAndExchangeCode(
clientId: AuthType.emailPassword.clientId,
redirectUrl: "com.example.app://oauth2redirect",
discoveryUrl: "https://example.com/auth/realms/yourrealm/.well-known/openid-configuration",
scopes: const ["openid", "profile", "roles"],
preferEphemeral: false,
);
await _handleTokenResponse(tkn);
} catch (e) {
FlutterError.presentError(FlutterErrorDetails(exception: e));
print("Error: " + e.toString());
}
}
Thank you so much for your input!