ios - 苹果登录使用安卓

标签 ios firebase flutter

我目前处于 Debug模式并在我的设备上运行我的应用。

我正在使用 sign_in_with apple 和这段代码

Future<FirebaseUser> signInWithApple() async {
var redirectURL = "https://SERVER_AS_PER_THE_DOCS.glitch.me/callbacks/sign_in_with_apple";
var clientID = "AS_PER_THE_DOCS";
final appleIdCredential = await SignInWithApple.getAppleIDCredential(
    scopes: [
      AppleIDAuthorizationScopes.email,
      AppleIDAuthorizationScopes.fullName,
    ],
    webAuthenticationOptions: WebAuthenticationOptions(
        clientId: clientID,
        redirectUri: Uri.parse(
            redirectURL)));
final oAuthProvider = OAuthProvider(providerId: 'apple.com');
final credential = oAuthProvider.getCredential(
  idToken: appleIdCredential.identityToken,
  accessToken: appleIdCredential.authorizationCode,
);
final authResult =
    await SignInUtil.firebaseAuth.signInWithCredential(credential);
return authResult.user; }

但在我登录 chrome 后,它会重定向到我在 Playstore 上的应用程序,当我尝试打开该应用程序时,日志显示:

E/flutter (19796): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: SignInWithAppleAuthorizationError(AuthorizationErrorCode.canceled, The user closed the Custom Tab)
E/flutter (19796): #0      SignInWithApple._signInWithAppleAndroid (package:sign_in_with_apple/src/sign_in_with_apple.dart:239:7)
E/flutter (19796): <asynchronous suspension>

我是否遗漏了一些我忘记添加的内容?

最佳答案

我发现了错误。原来是忘记加了

<activity
    android:name="com.aboutyou.dart_packages.sign_in_with_apple.SignInWithAppleCallback"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="signinwithapple" />
        <data android:path="callback" />
    </intent-filter>
</activity>

在我的 AndroidManifest.xml 文件中

关于ios - 苹果登录使用安卓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70960400/

相关文章:

android - 注意 : Recompile with -Xlint:deprecation. 注意:一些输入文件使用或覆盖已弃用的 API

flutter - 为什么我要删除构建/目录?

iOS Storyboard : set ImageView width and height not work

ios - 使用swift在ios上同时播放音频和振动

ios - Geofire (iOS) clang : error: linker command failed with exit code 1 (use -v to see invocation)

android - 使用实现或 api 时,Firebase 性能配置因 v1.1.2 而失败

swift - Firebase SDK pod 安装链接器错误

android - 如何解决异常:Gradle任务assembleDebug失败,退出代码为1

ios - 调用什么方法来处理 UIObject 的事件?

ios - 离开该 View 后维护数组中的数据?