flutter_web_auth导航问题从网页进行身份验证后,重定向不会以必需的访问令牌返回到应用程序

问题描述

在混乱中,我正在与fitbit Web api集成一起工作,在此过程中,我需要从其网站上对用户进行身份验证,之后我才能在重定向URL中获得access_token。因此,我需要访问该令牌并关闭该网页,并使用访问令牌重定向回我的应用程序以进行进一步的api调用

要实现上述流程,请使用 Flutter_web_auth 插件

这是我的代码:单击按钮后,将使用以下方法

  void authenticate() async {
// Present the dialog to the user
print('Before Authentication');
final result = await FlutterWebAuth.authenticate(
  url: "https://www.fitbit.com/oauth2/authorize?response_type=token&client_id=22BZMN&expires_in=2592000&scope=activity%20nutrition%20heartrate%20location%20nutrition%20profile%20settings%20sleep%20social%20weight&redirect_uri=https://tekfriday.com",//Todo: add &prompt=login to shwo login screen every time.
  callbackUrlScheme: "tekfriday",);
final token = Uri.parse(result).queryParameters['token'];
print('token');
print(token);

}

这是我的清单文件

        <activity android:name="com.tekfriday.wear_poc.CallbackActivity" >
        <intent-filter android:label="Flutter_web_auth">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.broWSABLE" />
            <data android:scheme="tekfriday" />
        </intent-filter>
    </activity>

身份验证流程正在正确进行,但是在身份验证之后,它不会重定向回我的应用程序。上面的代码有什么错误吗?。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)