FRAMEWORK/FLUTTER

flutter apple login android & ios 모두 완료

나나나나나나나ㅏ나난ㄴ나ㅏ나나 2022. 1. 6. 17:19
728x90

플루터하면 항상 소셜로그인이 들어가는데, 

많은 소셜로그인이 있지만 제일 힘든건 애플... 

애플은 ios랑 android를 따로 해주어야되는데, 애플이 자기꺼라고 ios만 편애하는거같다

 

https://pub.dev/packages/sign_in_with_apple

 

sign_in_with_apple | Flutter Package

Flutter bridge to initiate Sign in with Apple (on iOS, macOS, and Android). Includes support for keychain entries as well as signing in with an Apple ID.

pub.dev

공식 사이트에 설명이 잘 되어있지만, 모두 ios기준이다 

 

ios는 하라는대로하면 문제없이 잘 되지만 android는 이렇게 하면 아래와 같은 오류가 발생한다

그래서 안드로이드 코드만 작성해보려구한다

 

 

    String redirectURL = dotenv.env['APPLE_REDIRECT_URI'].toString();
    print(redirectURL);
    String? clientID = dotenv.env['APPLE_CLIENT_ID'];


    final appleIdCredential = await SignInWithApple.getAppleIDCredential(
        scopes: [
          AppleIDAuthorizationScopes.email,
          AppleIDAuthorizationScopes.fullName,
        ],
        webAuthenticationOptions: WebAuthenticationOptions(
            clientId: clientID!,
            redirectUri: Uri.parse(redirectURL),

        ));
    print(appleIdCredential.authorizationCode);
    this.socialLogin(appleIdCredential.authorizationCode, "apple");

 

안드로이드는 백엔드 서버의 콜백이 무조건 필요한 구조인데, 코드에서, 콜백을 지정해줘야된다는것! 

 

다음엔 해메지않고 바로 해결할 수 있기를 🙏🏻

 

참고 

https://stackoverflow.com/questions/62805312/android-sign-in-with-apple-and-firebase-flutter

 

Android Sign in with apple and firebase flutter

I'm using sign_in_with_apple and I've got the signin working for ios but the android component is not working. I've had a look through the docs and issues where this is asked but there are no clear

stackoverflow.com

 

728x90