loginWithKakaoTalk method
- List<
String> ? channelPublicIds, - List<
String> ? serviceTerms, - String? nonce,
KO: 카카오톡으로 로그인
channelPublicIds에 카카오톡 채널 프로필 ID 전달
serviceTerms 서비스 약관 목록 전달
ID 토큰 재생 공격 방지를 위한 검증 값, 임의의 문자열은 nonce에 전달
EN: Login with Kakao Talk
Pass list of Kakao Talk Channel IDs to channelPublicIds
Pass list of service terms to serviceTerms
Implementation
Future<OAuthToken> loginWithKakaoTalk({
List<String>? channelPublicIds,
List<String>? serviceTerms,
String? nonce,
}) async {
if (kIsWeb) {
throw KakaoClientException(
ClientErrorCause.notSupported,
'loginWithKakaoTalk() is not supported on web platforms.',
);
}
SdkLog.d(
'[UserApi.loginWithKakaoTalk] started | channelCount=${channelPublicIds?.length ?? 0} serviceTermsCount=${serviceTerms?.length ?? 0} nonceProvided=${nonce != null}',
);
final codeVerifier = generateRandomString(20);
final authCode = await _authCodeClient.authorizeWithTalk(
redirectUri: KakaoSdk.redirectUri,
nonce: nonce,
codeVerifier: codeVerifier,
channelPublicId: channelPublicIds,
serviceTerms: serviceTerms,
);
final token = await _authApi.issueAccessToken(
authCode: authCode,
redirectUri: KakaoSdk.redirectUri,
codeVerifier: codeVerifier,
);
await TokenManagerProvider.instance.manager.setToken(token);
SdkLog.i(
'[UserApi.loginWithKakaoTalk] completed | hasRefreshToken=${token.refreshToken != null}',
);
return token;
}