当我尝试使用 Twitter 登录时,我在 Flutter 应用程序中遇到“由于缺少初始状态而无法处理请求”。

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

当我尝试使用 Twitter 登录时,我面临“由于缺少初始状态而无法处理请求。如果浏览器 sessionStorage 无法访问或意外清除,则可能会发生这种情况”,即使我已在 Twitter 开发者门户中配置了应用程序并将其设置为 Firebase,并且我还在应用程序中定义了架构。enter image description here

我尝试在我的应用程序中使用 Twitter 功能登录。我也尝试过在 Twitter 开发者门户中添加回调 URL,但没有成功,请帮助我。

提前致谢。

flutter firebase twitter twitter-oauth
1个回答
0
投票

确保您正确阅读 [https://firebase.flutter.dev/docs/auth/social] 的文档

如果 flutterfire 文档中的代码实现不起作用,请使用下面的代码

    import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';

Future<UserCredential> signInWithFacebook() async {
  // Trigger the sign-in flow
  final LoginResult loginResult = await FacebookAuth.instance.login();

  // Create a credential from the access token
  final OAuthCredential facebookAuthCredential = FacebookAuthProvider.credential(loginResult.accessToken.token);

  // Once signed in, return the UserCredential
  return FirebaseAuth.instance.signInWithCredential(facebookAuthCredential);
}

注意:请务必阅读文档

© www.soinside.com 2019 - 2024. All rights reserved.