authorizeWithTalk method

Future<String> authorizeWithTalk({
  1. String? clientId,
  2. required String redirectUri,
  3. List<Prompt>? prompts,
  4. List<String>? channelPublicId,
  5. List<String>? serviceTerms,
  6. String? codeVerifier,
  7. String? nonce,
  8. String? kauthTxId,
  9. String? stateToken,
  10. bool webPopupLogin = false,
})

KO: 카카오톡으로 로그인: 리다이렉트 방식
EN: Login with Kakao Talk through redirection

Implementation

Future<String> authorizeWithTalk({
  String? clientId,
  required String redirectUri,
  List<Prompt>? prompts,
  List<String>? channelPublicId,
  List<String>? serviceTerms,
  String? codeVerifier,
  String? nonce,
  String? kauthTxId,
  String? stateToken,
  bool webPopupLogin = false,
}) async {
  try {
    final webStateToken =
        stateToken ?? (kIsWeb ? generateRandomString(20) : null);

    var response = await _openKakaoTalk(
      clientId ?? KakaoSdk.appKey,
      redirectUri,
      channelPublicId,
      serviceTerms,
      codeVerifier,
      prompts,
      nonce,
      kauthTxId,
      stateToken: webStateToken,
      webPopupLogin: webPopupLogin,
    );

    if (kIsWeb) {
      if (webPopupLogin) {
        return response;
      }
      var params = {
        'redirect_uri': redirectUri,
        'code': response,
        'state': webStateToken
      };
      await _channel.invokeMethod('redirectForEasyLogin', params);
      return response;
    }
    return _parseCode(response);
  } catch (e) {
    SdkLog.e(e);
    rethrow;
  }
}