使用Flutter Webview显示网站时如何自动登录?

时间:2020-08-26 11:40:44

标签: flutter authentication webview

与上面的代码一样,URL地址使用webview显示为App。 有没有一种自动登录的方法?

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: SafeArea(
            child: WebView(
              initialUrl: 'login page url',
              javascriptMode: JavascriptMode.unrestricted,
            ),
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _showNotification,
          tooltip: 'Increment',
          child: Icon(Icons.access_alarms),
        ),
      ),
    );
  }
}

1 个答案:

答案 0 :(得分:0)

我认为您可以在首次登录后尝试使用Cookie。我正在使用“ CookieManager”控件从我的Web视图URL中获取参数令牌。

相关问题