fluttercommunity / fluttercommunity/flutter_webview_plugin
onUrlChanged.listen never called on iOS
- Lingua principale
- Java
- Stelle
- 1.5k
- Fork
- 938
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## System info
Issue occurs on: iOS
Plugin version: xxx
#Problem
I am using onUrlChanged.listen in order to get the code of OAuth2 authentication. I get this code by listening to url changes, and it works fine on Android. When I launch it in iOS, I get a blank white screen. When I try to debug, I see that onUrlChanged.listen callback is never being called.
Here is my code:
void main() {
WidgetsFlutterBinding.ensureInitialized();
LoginController _loginController = new LoginController();
_loginController.getCodeWebView().then((FlutterWebviewPlugin flutterWebView) {
//deal here with webview and token request
flutterWebView.onUrlChanged.listen((String url) async {
if (url.length > 25) {
int endIndex = url.indexOf("&state");
if (url.contains("code=")) {
String code = url.substring(
url.indexOf('code') + 5, endIndex); //with "http://localhost:4200/
flutterWebView.close();
String accessToken = await _loginController.getAccessToken(code);
_loginController.decodeJwtAndPopulateUser(accessToken);
//Now that we have the token, we can instantiate layout with async calls that depends on token
runApp(
AppContainer(accessToken)
);
}
}
});
});
}
Can anyone help me please? I am struggling with it. I don't know if its a bug. I am testing it in iOS 13.3 and I already added the info.plist things to support webview_plugin:
`
NSAllowsArbitraryLoads
NSAllowsArbitraryLoadsInWebContent
`
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.