Flutter ios 카카오톡 로그인 실패

문의 시 사용하시는 SDK 버전 정보와 플랫폼(Android / iOS) 및 디벨로퍼스 앱ID를 알려주세요.


kakao_flutter_sdk 1.9.7+3 사용하는 플러터앱의 ios에서 언제부터인지 카카오톡 로그인이 안되네요.

1.10.0 적용해봐도 마찬가지입니다.

앱ID는 1046827 입니다.

참고로 loginWithKakaoAccount 로는 잘 되고, loginWithKakaoTalk 으로 한 경우 카톡앱이 열렸다가 다시 돌아오기는 하는데 리턴값을 주지 않고 멈춰버립니다.

다른 질문 참고해서 혹시나 스킴을 못받는게 문제인가 해서 아래와 같이 AppDelegate.swift 를 수정했고 kakao oauth received 로그가 잘 찍히는 것 까지는 확인했는데 여전히 flutter 코드에서 OAuthToken을 받지 못하고 있네요. 확인 부탁 드립니다.

import UIKit
import Flutter
import NidThirdPartyLogin

@main
@objc class AppDelegate: FlutterAppDelegate {
    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        GeneratedPluginRegistrant.register(with: self)

        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }

    override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
        if (NidOAuth.shared.handleURL(url) == true) { // If the URL was passed from the Naver app
          return true
        }

        debugPrint("url: \(url)")
        debugPrint("url.scheme: \(url.scheme)")
        debugPrint("url.host: \(url.host)")

        if (url.scheme?.hasPrefix("kakao") == true && url.host == "oauth") {
            debugPrint("kakao oauth received")
            return true
        }

        // Handle URLs coming from other apps
        return false
    }
}

안녕하세요.

자세한 확인을 위해 Info.plist의 URL Schemes 설정과 xcode 로그도 함께 부탁드립니다.

아래 레포에 재현되는 코드를 올려두었습니다.
https://github.com/sebatyler/purplewhale_kakao
https://github.com/sebatyler/purplewhale_kakao/blob/main/ios/Runner/Info.plist

URL schemes 설정: .env 파일에 정의한 환경변수를 사용하도록 했어요.

xcode 로그

안녕하세요

AppDelegate.swift 파일에서 application(_:open:options)을 아래와 같이 수정 부탁드립니다.

override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    if (NidOAuth.shared.handleURL(url) == true) { // If the URL was passed from the Naver app
        return true
    }

    // Handle URLs coming from other apps
    return super.application(app, open: url, options: options)
}

첨부해주신 코드는 true 혹은 false를 반환하고 있어서 kakao_flutter_sdk의 ios 플러그인까지 url 스킴이 전달되지 못했습니다. 위와 같이 수정했을 때도 동일하게 이슈가 발생한다면 말씀 부탁드립니다.

2개의 좋아요

알려주신 대로 수정한 후 잘 동작하네요.

감사합니다!

1개의 좋아요