Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple sign in using android

I'm currently on debug mode and run my app on my device.

I'm using sign_in_with apple and this code

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; }

But after I sign in on chrome it redirects to my app on playstore and when I try to open the app the logs says:

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>

Am I missing something that I forgot to add?

like image 924
Tony Stark Avatar asked Nov 15 '25 20:11

Tony Stark


1 Answers

I found the error. It turns out that I forgot to add

<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>

On my AndroidManifest.xml file

like image 146
Tony Stark Avatar answered Nov 18 '25 10:11

Tony Stark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!