Skip to content

Commit

Permalink
feat: Kakao Login 성공 시 사용자의 id, email, profileUrl을 넘겨주는 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
comst19 committed Jan 17, 2024
1 parent 7d33537 commit 5728674
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.droidblossom.archive.presentation.ui.auth

import android.app.Activity
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.activityViewModels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class SocialLoginUtil(private val context: Context, private val callback: LoginC
callback.onLoginFailure(error)
} else if (token != null) {
//Log.e("카카오", "로그인 성공 ${token.accessToken}")
//callback.onLoginSuccess(AuthViewModel.Social.KAKAO)
kakaoGetUserInfo()
}
}
Expand All @@ -47,7 +46,6 @@ class SocialLoginUtil(private val context: Context, private val callback: LoginC
callback.onLoginFailure(error)
} else if (token != null) {
//Log.e("카카오", "로그인 성공 ${token.accessToken}")
//callback.onLoginSuccess(AuthViewModel.Social.KAKAO)
kakaoGetUserInfo()
}
}
Expand All @@ -59,11 +57,10 @@ class SocialLoginUtil(private val context: Context, private val callback: LoginC
if (error != null) {
Log.e("카카오", "사용자 정보 요청 실패", error)
} else if (user != null) {
Log.i("카카오", "사용자 정보 요청 성공" +
"\n회원번호: ${user.id}" +
"\n이메일: ${user.kakaoAccount?.email}" +
"\n프로필사진: ${user.kakaoAccount?.profile?.thumbnailImageUrl}")
//callback.onLoginSuccess(user.id.toString(),AuthViewModel.Social.KAKAO)
val authId = user.id.toString()
val email = user.kakaoAccount?.email ?: ""
val profileUrl = user.kakaoAccount?.profile?.thumbnailImageUrl ?: ""
callback.onLoginSuccess(authId, email, profileUrl, AuthViewModel.Social.KAKAO)
}
}
}
Expand Down

0 comments on commit 5728674

Please sign in to comment.