提供的身份验证凭据格式错误、已过期或当前不受支持。通过 Firebase 使用 LINE 登录时

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

我使用 LINE 登录,代码如下

  Future<UserCredential?> signIn() async {
    try {
      final result =
          await LineSDK.instance.login(scopes: ["profile", "openid", "email"]);

      final oauthCredential = OAuthProvider("LINE").credential(
          accessToken: result.accessToken.idTokenRaw, signInMethod: 'LINE');
      return await FirebaseAuth.instance.signInWithCredential(oauthCredential);
    } catch (e) {
      return null;
    }
  }

但是执行时出现异常

[firebase_auth/invalid-credential] The supplied auth credential is malformed, has expired or is not currently supported.
return await FirebaseAuth.instance.signInWithCredential(oauthCredential);

还有另一条日志不知道是否相关

[connection] nw_connection_copy_metadata_block_invoke [C54] Client called nw_connection_copy_metadata on unconnected nw_connection Support for an auth provider with identifier 'LINE' is not implemented.

我已在 Firebase 中启用 LINE Provider

pubspec.yaml

  firebase_auth: ^4.13.0
  flutter_line_sdk: ^2.3.5
flutter oauth-2.0 firebase-authentication
1个回答
0
投票

我也遇到过类似的错误,就我而言,问题是我写下了错误的客户端 ID。

另外,请检查提供商 ID。

我使用了“kakao”,“oidc.kakao”是提供商 ID。 所以...将 firebase 和代码中的“LINE”修复为“line”:

OAuthProvider("LINE")

OAuthProvider("oidc.line")

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