Flutter url_launcher - 令牌在 iOS 和 Android 模拟器上不起作用

问题描述 投票:0回答:1

在以下代码中使用 url_launcher 时,iOS 和 Android 模拟器中不考虑令牌。它打开从登录页面开始的 URL,同时使用“授权”标头和令牌,它应该已经被视为登录用户。

相同的代码适用于 Flutter Web 的所有模式(inAppWebView、inAppBrowserView、externalApplication),并且页面会在用户已登录的情况下打开。

Future<void> _launchInWebView(Uri url) async {
    try {
      await launchUrl(url, mode: LaunchMode.inAppWebView,
          webViewConfiguration: WebViewConfiguration(
              headers: EndUserApiRequest.ssoHeaders
          ));
    } on Exception catch (e) {
      if (kDebugMode) print(e.toString());
    }
  }

正如您在此屏幕截图中看到的,令牌标头包含在调用中。

Token header is properly set

flutter jwt token simulator url-launcher
1个回答
0
投票

尝试使用 InAppWebView 来代替,看看问题是否仍然存在。根据我的经验,InAppWebView 更可靠

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.