-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ab36fc
commit bdaab40
Showing
4 changed files
with
75 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import UIKit | |
import SnapKit | ||
import Then | ||
import GoogleSignIn | ||
import KakaoSDKUser | ||
|
||
class SNSLoginVC: UIViewController { | ||
|
||
|
@@ -80,6 +81,7 @@ class SNSLoginVC: UIViewController { | |
$0.titleLabel?.font = UIFont.notoSansMediumFont(ofSize: 14) | ||
$0.layer.cornerRadius = 10 | ||
$0.clipsToBounds = true | ||
$0.addTarget(self, action: #selector(kakaoLogin), for: .touchUpInside) | ||
} | ||
|
||
@objc func googleLogin() { | ||
|
@@ -91,6 +93,70 @@ class SNSLoginVC: UIViewController { | |
} | ||
} | ||
|
||
@objc func kakaoLogin() { | ||
// if (UserApi.isKakaoTalkLoginAvailable()) { | ||
// UserApi.shared.loginWithKakaoTalk {(oauthToken, error) in | ||
// if let error = error { | ||
// print(error) | ||
// } | ||
// else { | ||
// print("loginWithKakaoTalk() success.") | ||
// _ = oauthToken | ||
// let accessToken = oauthToken?.accessToken | ||
// } | ||
// } | ||
// } | ||
|
||
print("카카오 로그인 called") | ||
|
||
if (UserApi.isKakaoTalkLoginAvailable()) { | ||
UserApi.shared.loginWithKakaoTalk { (oauthToken, error) in | ||
if let error = error { | ||
print(error) | ||
} | ||
|
||
else { | ||
print("login success") | ||
print(oauthToken) //토큰 정보 | ||
print(UserApi.shared.me() { (user, error) in | ||
if let error = error { | ||
print(error) | ||
} | ||
else { | ||
|
||
var scopes = [String]() | ||
if (user?.kakaoAccount?.emailNeedsAgreement == true) { scopes.append("account_email") } | ||
if scopes.count != 0 { | ||
UserApi.shared.loginWithKakaoAccount(scopes: scopes) { (_, error) in | ||
if let error = error { | ||
print(error) | ||
} else { | ||
UserApi.shared.me() { (user, error) in | ||
if let error = error { | ||
print(error) | ||
} else { | ||
|
||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
else { | ||
print("사용자 이메일은 \(user?.kakaoAccount?.email!)") | ||
} | ||
} | ||
|
||
}) | ||
} | ||
|
||
} | ||
} | ||
else { | ||
print("미설치") | ||
} | ||
} | ||
|
||
@objc func socialLogin() { | ||
SocialLoginService.shared.socialLogin(email: "[email protected]") { (response) in | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters