flutter_facebook_auth: 提供的授权凭证格式错误或已过期

flutter_facebook_auth: The supplied auth credential is malformed or has expired

我正在尝试使用 flutter_facebook_auth 3.3.2+2 包和 firebase_auth 1.0.3 进行 facebook 登录,我基本上是从他们的文档中复制并粘贴代码 https://facebook.meedu.app/#/firebase-auth

import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_facebook_auth/flutter_facebook_auth.dart';

Future<UserCredential?> signInWithFacebook() async {
  final LoginResult result = await FacebookAuth.instance.login();
  if(result.status == LoginStatus.success){
    // Create a credential from the access token
    final OAuthCredential credential = FacebookAuthProvider.credential(result.accessToken!.token);
    // Once signed in, return the UserCredential
    return await FirebaseAuth.instance.signInWithCredential(credential);
  }
  return null;
}

我尝试用它登录,但是当它进入代码 await FirebaseAuth.instance.signInWithCredential(credential); 它弹出错误:E/flutter (23237): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: [firebase_auth/invalid-credential] The supplied auth credential is malformed or has expired. [ Remote site 5XX from facebook.com for VERIFY_CREDENTIAL ]

我已经检查了所有的应用程序 ID、应用程序秘密、回调 url、程序包名称都匹配, 我不知道我做错了什么。谁能告诉我发生了什么事?

可能有多种原因: Choosing wrong app type in Facebook console instead of "Build Connected Experiences"

另外:

  • 错误bundle/app/packageid/name
  • 错误的 API 密钥和秘密