loginWithKakaoTalk method
- List<
String> ? channelPublicIds, - List<
String> ? serviceTerms, - String? nonce,
KO: 카카오톡으로 로그인
channelPublicIds
에 카카오톡 채널 프로필 ID 전달
serviceTerms
서비스 약관 목록 전달
EN: Login with Kakao Talk
Pass Kakao Talk Channel's profile IDs to channelPublicIds
Pass List of service terms to serviceTerms
Implementation
Future<OAuthToken> loginWithKakaoTalk({
List<String>? channelPublicIds,
List<String>? serviceTerms,
String? nonce,
}) async {
var codeVerifier = AuthCodeClient.codeVerifier();
String? stateToken;
String? redirectUrl;
if (kIsWeb) {
stateToken = generateRandomString(20);
redirectUrl = await AuthCodeClient.instance.platformRedirectUri();
}
final authCode = await AuthCodeClient.instance.authorizeWithTalk(
redirectUri: redirectUrl ?? KakaoSdk.redirectUri,
channelPublicId: channelPublicIds,
serviceTerms: serviceTerms,
codeVerifier: codeVerifier,
nonce: nonce,
stateToken: stateToken,
webPopupLogin: true,
);
final token = await AuthApi.instance.issueAccessToken(
redirectUri: redirectUrl,
authCode: authCode,
codeVerifier: codeVerifier);
await TokenManagerProvider.instance.manager.setToken(token);
return token;
}